There are a few of us running a script on our front page, Forecast Summary.
It takes the forecast discussion and trims it down into a nice neat text file for display.
It's the same as forecast-discussion.php except for the trim feature. It worked well up until yesterday
with the latest NWS changes. I have the file working except for the trim command. The enrite page displays
in the cache file.
What we used to get was:
.SYNOPSIS...
High pressure over the area will slide east and allow a complex
storm system to approach the area from the Ohio valley. This
storm will bring rain, and then snow to the area beginning late
Thursday and continuing into the weekend.
&&
and this would display on our pages. Would the trim command need to be modified with the
NWS changes yesterday?
Here's what the trim looks like withing the script
preg_match('|<pre[^>]*>(.*)</pre>|Usi',$html,$matches);
$discussion = $matches[1]; // now have the forecast as a string with \n delimiters
$discussion = trim($matches[1]); // prevent extra white space at beginning and end
$discussion = str_replace(array("\r", "\n"), ' ', $discussion); //delete the linefeeds in the middle
$sstring = 'SYNOPSIS'; // start of synopis quick text
$estring = '&&'; // first divider
$start = strpos($discussion,$sstring); // starting position of where to keep
$end = strpos($discussion,$estring); // end of where to keep
$discuss = substr($discussion, $start+0, ($end-1-$start)); // new text (too long to print in cell format)
$charwrap = round($pagewidth/7.25);
$discussion = wordwrap ($discuss); // for cell phone roughly 8:1 ratio characters.
Will we need to start from scratch once again?
Tony