Beaufort wind text question

Hi !
I’m having trouble getting the Beaufort wind text to show. See: forecast

I’ve got the setting for beaufort set to ‘T’ in plaintext-parser.php. So it must be something else? I’ve enclosed the code I’m using below.
TIA
–Kevin H.


plaintext-parser_new.txt (30.2 KB)

What happens if you use the other option? Does that work?

$showBeaufort = ‘V’;

If that works, it would indicate the issue is with the

if ($showBeaufort == 'T') { return( get_lang($BeaufortText[$Bft]) ); }

Section of code.

Thanks for the reply Kevin!
I tried using ‘V’ as you suggested. I guess that’s supposed to return ‘n Bft’?.. but nothing showed with that setting either.

Ok, that is very strange.

Would you mind changing your code from

//   $Status .= "<!-- dir='" . $WXSIMwinddir[$i] . "' wind='" . $WXSIMwind[$i] . 
     "' gust='" . $WXSIMgust[$i] . "' units='" . $WXSIMwindunits[$i] . 
	 "' maxWind = '$maxWind' Beaufort='" . $WXSIMBeaufort[$i] . "'-->\n";

to

   $Status .= "<!-- dir='" . $WXSIMwinddir[$i] . "' wind='" . $WXSIMwind[$i] . 
     "' gust='" . $WXSIMgust[$i] . "' units='" . $WXSIMwindunits[$i] . 
	 "' maxWind = '$maxWind' Beaufort='" . $WXSIMBeaufort[$i] . "'-->\n";

so we can see the parser work a bit better.

Kevin (krelvinaz) is correct… setting $showBeaufort = ‘V’; should display ‘n Bft’ on the Beaufort line. Hopefully, uncommenting the code as show above will give us visibility into what’s happening with the parsing.

Best regards,
Ken

Ok, I think I found the issue.

First, the code I’d asked you to uncomment was one long line in my original source, but your copy of the source had line folds there, so I’m surprised it didn’t give you a PHP error. Please uncomment as shown above.

I ran a copy of your script on my site and had the same issue, but with the $Status line uncommented, I could see that the Beaufort was working

<!-- plaintext-parser.php Version 1.06 - 06-Sep-2007 -->
<!-- wdate '5:00 PM Sep 9, 2007' -->
<!-- updated '9-Sep-2007 17:00 -0400'-->
<!-- dir='E' wind='4' gust='' units='mph' maxWind = '4' Beaufort='Light breeze'-->
<!-- dir='ESE' wind='6' gust='' units='mph' maxWind = '6' Beaufort='Light breeze'-->
<!-- dir='ENE&rarr;SE' wind='2' gust='' units='mph' maxWind = '2' Beaufort='Light air'-->
<!-- dir='S&rarr;WNW' wind='3' gust='' units='mph' maxWind = '3' Beaufort='Light air'-->
<!-- dir='W' wind='5' gust='' units='mph' maxWind = '5' Beaufort='Light breeze'-->

<!-- dir='WSW&rarr;NNW' wind='3' gust='' units='mph' maxWind = '3' Beaufort='Light air'-->
<!-- dir='NNE&rarr;ESE' wind='2' gust='' units='mph' maxWind = '2' Beaufort='Light air'-->
<!-- dir='E' wind='7' gust='' units='mph' maxWind = '7' Beaufort='Light breeze'-->
<!-- dir='ENE' wind='3' gust='' units='mph' maxWind = '3' Beaufort='Light air'-->
<!-- maxWidth='640px' nTD=9 wTD='71px' -->

But, my copy, like yours, wasn’t printing the Beaufort. Looking further down in the code, I found the problem. Your copy had

          <tr valign ="top" align="center">
	  <?php
	  for ($i=0;$i<count($WXSIMwinddir);$i++) {
	    print "<td style=\"width: $wTD;\">" . $WXSIMwinddir[$i] . "
 " .
		$WXSIMwind[$i] . "
 " . $WXSIMwindunits[$i] . "</td>\n";
	  }
	  ?>
          </tr>

in the printing section for wind. It should have

          <tr valign ="top" align="center">
	  <?php
	  for ($i=0;$i<count($WXSIMwinddir);$i++) {
	    print "<td style=\"width: $wTD;\">" . $WXSIMwinddir[$i] . "
 " .
		$WXSIMwind[$i] . "
 " . $WXSIMwindunits[$i]; 
		if ($showBeaufort) {
		  print "
<i>" . $WXSIMBeaufort[$i] ."</i>";
		}
		print "</td>\n";
	  }
	  ?>
          </tr>

in order to actually print the Beaufort value.

Make that change, and your Beaufort should appear :wink:
http://saratoga-weather.org/plaintext-parser-rockcreek.php

Best regards,
Ken

I Made the change to the wind print section as you instructed, and it’s working perfectly. WxSim Forecast
When I upgraded from 1.03 to 1.06, I copied the entire html - print section of the old 1.03 code to the new 1.06 version, without doing a comparison between the two first.#-o My very bad :oops:. A long time ago I modified that section with tables-inside-of-tables, in order to center things and still be xhtml compliant. There’s a thread somewhere else, about xhtml compliance and the need to worry about it. I’m beginning to wonder now myself. Thank you, Ken! :smiley: