Author Topic: Rogue semi-colon WBv2  (Read 12908 times)

Offline w9sbu

  • Jr. Member
  • **
  • Posts: 11
    • Weather Station W9SBU
Rogue semi-colon WBv2
« 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
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  -->

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Rogue semi-colon WBv2
« Reply #1 on: March 24, 2016, 05:39:11 PM »
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

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Rogue semi-colon WBv2
« Reply #2 on: March 24, 2016, 06:34:27 PM »
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

Andy

Offline w9sbu

  • Jr. Member
  • **
  • Posts: 11
    • Weather Station W9SBU
Re: Rogue semi-colon WBv2
« Reply #3 on: March 25, 2016, 09:49:19 AM »
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.

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Rogue semi-colon WBv2
« Reply #4 on: March 25, 2016, 01:17:49 PM »
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


Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Rogue semi-colon WBv2
« Reply #5 on: March 25, 2016, 03:47:28 PM »
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

Offline w9sbu

  • Jr. Member
  • **
  • Posts: 11
    • Weather Station W9SBU
Re: Rogue semi-colon WBv2
« Reply #6 on: March 26, 2016, 09:09:22 AM »
That's It!!
Outstanding!
Promote this guy to master bug catcher!

Go figure it was code I added ya hey!

Offline w9sbu

  • Jr. Member
  • **
  • Posts: 11
    • Weather Station W9SBU
Re: Rogue semi-colon WBv2
« Reply #7 on: March 26, 2016, 09:26:43 AM »
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?

Offline Andy9164

  • Full Member
  • ***
  • Posts: 87
    • Midlifedad
Re: Rogue semi-colon WBv2
« Reply #8 on: March 27, 2016, 04:09:47 AM »
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