Weather by You!
Templates and Projects support => Php templates => Topic started by: w9sbu on March 24, 2016, 09:21:09 AM
-
I have a semi-colon on my index page that is uninvited. Immediately above "Conditions at local time."
I have gone through index.php and index_text.php many times and cannot find it's source. Code is below if anyone can spot what I can't find. http://w9sbu.wolf-running.com/weather/index.php (http://w9sbu.wolf-running.com/weather/index.php)
index_text:
<!-- WEATHER DATA BEGIN -->
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="Observations actuelles">
<caption style="text-align: left">
<strong>
<?php
echo $Tr_CondAt.' '.$time;
if ($currcondenc != "") { echo '.</br>'.$Tr_currcond.': '.$currcondenc; }
?>
</strong>
</caption>
index.php:
<h1><?php echo $Tr_forecast; ?> : <span style="color: #000"><?php echo $forecast; ?></span></h1><br />
<!-- WEATHER DATA INCLUSION -->
<?php include('index_txt.php')?>
<div style="clear: both"></div>
</div>
<!-- Right side column -->
-
Hi,
I compared your code to mine (which is a slight variation of this template). The only difference I can see is that I have a semicolon in front of the closing ? as below
<?php include('index_txt.php');?>
Your code is
<?php include('index_txt.php')?>
It seems a bit wrong that not having a semicolon would produce a semicolon but I am not an expert on php but good at playing spot the difference. Give it a try.
If it doesn't solve it can you paste the opening of your index_txt.php file from the beginning up to and including where you see the first "table" command ( a couple of lines after <!-- WEATHER DATA BEGIN -->
Andy
-
Hi,
I took a look at you're source code using Firefox and although the semicolon is missing as above I don't think this is it. I think the problem is in you index_txt.php file. Can you attach it so I can take a look. When I use the tools in Firefox it appears the semicolon appears after you have asked to include the index_txt file.
I am a novice but over the last 2 years I built my website using the WB2 template as a starting point and with a lot of reading and help here in the forum ( particularly from Jacques) I have and am still learning a lot.
www.midlifedad.me.uk (http://www.midlifedad.me.uk)
Andy
-
Thanks Guys. I replaced the missing semi-colon you all spotted in the code. No effect. I had taken it out thinking it was the culprit, however, it seems to have no effect in the web browser. I use dreamweaver mx and it usually highlights bad code but it doesn't care if it's there or not.
I'll attach index_text.php for those who like to track down those pesky characters.
I had to add ".txt" extension so the forum server would accept it.
-
Hi,
Well this is bamboozling. What I have found so far.
The problem is with the index_txt.php file. I have a test server here and I replaced my file with yours and I saw the semicolon. Put my original file back and the semicolon disappears.
I noticed this section of code is inside your first table.
<caption style="text-align: left">
<strong>
<?php
echo $Tr_CondAt.' '.$time;
if ($currcondenc != "") { echo '. '.$Tr_currcond.': '.$currcondenc; }
?>
</strong>
</caption>
Mine is before so I tried placing it directly after where it says <!-- WEATHER DATA BEGIN --> in your file.
You still get the same formatting but interestingly the rogue semicolon now appears at the end of the Conditions at local time / date statement rather than above it.
I tried editing the above code out and you still get a semicolon.
Haven't given up yet, I like a challenge.
Don't know if the above puts any lights on anywhere for anybody
Andy
-
Hi,
FOUND IT !!!!!!! :)
<?php echo '<td>'.$Tr_TotPrecip.'</td><td>'.$comprecip.' '.$snowunit.'</td>' ?>;
should be replaced with
<?php echo '<td>'.$Tr_TotPrecip.'</td><td>'.$comprecip.' '.$snowunit.'</td>' ;?>
Your rogue semicolon is outside the php
I dont know why it puts it where it does, maybe somebody with a bit more php knowledge will know.
Andy
-
That's It!!
Outstanding!
Promote this guy to master bug catcher!
Go figure it was code I added ya hey!
-
That was less than 6 hours. 8)
I have to know; how long was it from the time you downloaded the file to when you busted the responsible semi-colon? Did you use a program or just text editor?
-
So pleased I was able to help. It took about an hour. No fancy programs or text editors. I did try to use the compare plugin in Notepad++ but as I had changed the original file it brought up too many differences.
I "commented out" sections of the tables using <!-- at the beginning and --> at the end and worked my way through a section at a time, saved the file, uploaded to my local test server and refreshed my screen. When the semicolon disappeared then it was in that section. Then it was jus a case of looking.
Glad it's sorted.
Andy