Page 1 of 1

PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 8:43 am
by water01
On my webpages I have an include for the credits lines at the bottom of each page. Included in it is a bit of code that displays the Version number and Build of CumulusMX.

Code: Select all

<span style="color: #CC0000">v<?php echo $version?></span> (<span style="color: #CC0000"><?php echo $build?></span>) using <span style="color: #CC0000"><?php echo $tagfilename?></span> (<span style="color: #CC0000"><?php echo $tagversion?></span>)<br>  
The bit that I cannot understand is why does the above code shows this on the main index.php page

Image

but this on every other page.

Image

Where are the extra v and brackets coming from??????? :bash: :bash: :bash:

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 9:57 am
by broadstairs
I suspect this is because your definition of the $build variable is different on other pages! Without seeing the full php code it is difficult to know for sure.

Stuart

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 10:22 am
by water01
Thanks but that cannot be true as it is an include i.e. all pages say

Code: Select all

            <?php
                include 'includes/credits.php';
            ?>
and here is credits.php

Code: Select all

<p class="credits">
<p style="text-align: center">© <?php echo $year?>, Burnham-on-Sea Weather.&nbsp;&nbsp;
Page updated <?php echo $update?><br>
Powered by
<a href="https://cumulus.hosiene.co.uk/" target="_blank"><span style="color: #CC0000">Cumulus MX</span><img src="https://www.dmjsystems.co.uk/weatherbos/images/cumulussmall.png" width="39" height="16" alt=""></a>
<span style="color: #CC0000">v<?php echo $version?></span> (<span style="color: #CC0000"><?php echo $build?></span>) using <span style="color: #CC0000"><?php echo $tagfilename?></span> (<span style="color: #CC0000"><?php echo $tagversion?></span>)<br>
Never base important decisions on this or any weather information obtained from the Internet.<br>
Copyright &copy; CSS3_photo_dark | <a href="https://www.css3templates.co.uk">design from css3templates.co.uk</a></p>
</p>
So how does it give different results??????

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 11:27 am
by wurzelmac

Code: Select all

<span style="color: #CC0000">v<?php echo $version?></span> (<span style="color: #CC0000"><?php echo $build?></span>)
What happens when you are removing the "v" and the brackets - maybe they are hardcoded by the tag?

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 11:37 am
by water01
Thanks for the suggestion but sorry tried that and they are not hard coded into the webtag.

Code: Select all

$version                    = "4.2.0";  //  version of Cumulus in use 

Code: Select all

$build                      = "4037";  //  build of Cumulus in use

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 11:55 am
by broadstairs
I've just looked at your website and then viewed the source for the main page which shows the double brackets and double v. Looking at the source the code as

Code: Select all

<span style="color: #CC0000">vv4.2.0</span> (<span style="color: #CC0000">(4037)</span>)
The fact that it shows 'vv4.2.0' and '(4037)' means that the PHP code has the variable set with the extra 'v' and brackets already in place. On another page source shows

Code: Select all

<span style="color: #CC0000">v4.2.0</span> (<span style="color: #CC0000">4037</span>)
with no extra 'v' and no brackets '4037' means that the variable value does not have the 'v' and brackets set.

So sorry but the PHP code to set the variable values must be different. PHP is doing what it is told to do and the fault lies elsewhere. There must be different copies of the PHP code being executed. Code is dumb it does exactly what it is told to do!

Make sure you do not have old PHP versions of it lying around.

Stuart

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 2:11 pm
by water01
OK OK OK you are right but not with another version of my code in the include!! So I started looking for other things that might use the same PHP webtags and voila!!

My index.php uses the BT's Global Sager weathercaster viewtopic.php?t=9901 and it also uses the same webtags formatted the same way and since it is called before my code result equals double v's and brackets.

Thank you, you made me go and look elsewhere and find out what was unique to that PHP page that nothing else used!! and up popped BT's Global Sager with the same webtags.

No wonder I couldn't find it I was looking in completely the wrong place!! :bash: :bash: :bash:

All fixed!!

Re: PHP experts I am puzzled!!

Posted: Wed 25 Sep 2024 2:48 pm
by broadstairs
David if I had a penny for everytime that happened to me I'd be rich. You get so tied up in what you're doing you get blinkered! ;)

Stuart