Author Topic: NWS website changed .. advforecast2.php V3.03 02-Jul-2012 now available  (Read 24408 times)

0 Members and 1 Guest are viewing this topic.

Offline n3ouc

  • Contributor
  • ***
  • Posts: 123
    • Air Products Campus Weather
Ryan,
You dont do anything with notepad with the new version. You just copy it directly over the old file in your website directory by ftp'ing over it. It should work fine as long as you didnt change anything in your settings.php file.

Mike
Mike Stanton
Air Products Campus Weather

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Ryan,

Since you're using the V3 template set, you can just replace your existing advforecast2.php with the updated copy. All the customization for the script is already in your Settings.php in your template and no additional script changes to advforecast2.php are needed.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline DaculaWeather

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3206
    • North Georgia Weather
Got all of mine working. Thanks for getting  me pointed in the right direction Ken and thank you for everything you do for us.
I just wish they wouldn't the full word Thunderstorms!
Looks Good, glad you got it working!  =D>
Thanks Derek! Me too! Not exactly the way I wanted to spend the evening on my vacation but hey, at least I could fix it!!!

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Ryan,

Since you're using the V3 template set, you can just replace your existing advforecast2.php with the updated copy. All the customization for the script is already in your Settings.php in your template and no additional script changes to advforecast2.php are needed.

I did this Ken




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline capeweather

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 1309
    • http://www.capeweather.com
Ken,
I was forced to update to the new NWS changes from version 1 to 3 and noticed a small bug to specify the forecast update. I think line 39 needs to be changed from:

//$forecastupdate  This is the time of last update

to

//$forecastupdated  This is the time of last update

Im setting up a custom forecast layout and was referencing those switches.

By the way, thanks for resolving the problem so quickly!


Chris
Cape Coral, Florida
Website: http://www.capeweather.com
Website: http://www.fortmyersweather.net

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Ryan,
You dont do anything with notepad with the new version. You just copy it directly over the old file in your website directory by ftp'ing over it. It should work fine as long as you didnt change anything in your settings.php file.

Mike

Not for me it don't




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
I copied it over the old one and come up with this.. http://www.hayskansasweather.com/wxforecast.php

I never touched settings.php




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline WeatherBeacon

  • Chief
  • Forecaster
  • *****
  • Posts: 1369
    • http://www.wxbeacon.com

Thanks immensely, Ken! =D>
Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Kind of strange everyone has it working but me :sad:




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Ryan,
In your Settings.php you have
Code: [Select]
$SITE['NWSforecasts']   = array( // for the advforecast2.php V3.xx version script
// use "Zone|Location|Point-printableURL",  as entries .. first one will be the default forecast.
  "CAZ513|Saratoga|http://forecast.weather.gov/MapClick.php?CityName=Saratoga&state=CA&site=MTR&textField1=37.2639&textField2=-122.022&e=1&TextType=2",
"CAZ513|Los Gatos|http://forecast.weather.gov/MapClick.php?CityName=Los+Gatos&state=CA&site=MTR&textField1=37.2267&textField2=-121.974&e=0&TextType=2",
"CAZ513|Cupertino|http://forecast.weather.gov/MapClick.php?CityName=Cupertino&state=CA&site=MTR&textField1=37.3231&textField2=-122.031&e=0&TextType=2",
"CAZ513|Sunnyvale|http://forecast.weather.gov/MapClick.php?CityName=Sunnyvale&state=CA&site=MTR&textField1=37.3689&textField2=-122.035&e=0&TextType=2",
"CAZ513|Santa Clara|http://forecast.weather.gov/MapClick.php?CityName=Santa+Clara&state=CA&site=MTR&textField1=37.3542&textField2=-121.954&e=0&TextType=2",
"CAZ513|San Jose|http://forecast.weather.gov/MapClick.php?CityName=San+Jose&state=CA&site=MTR&textField1=37.3394&textField2=-121.894&e=0&TextType=2",
"CAZ508|Mountain View|http://forecast.weather.gov/MapClick.php?CityName=Mountain+View&state=CA&site=MTR&textField1=37.3861&textField2=-122.083&TextType=2",
"CAZ529|Santa Cruz|http://forecast.weather.gov/MapClick.php?CityName=Santa+Cruz&state=CA&site=MTR&textField1=36.9742&textField2=-122.03&e=0&TextType=2",
"CAZ006|San Francisco|http://forecast.weather.gov/MapClick.php?CityName=San+Francisco&state=CA&site=MTR&textField1=37.775&textField2=-122.418&e=0&TextType=2",
);
 You can change that to
Code: [Select]
/*
$SITE['NWSforecasts']   = array( // for the advforecast2.php V3.xx version script
// use "Zone|Location|Point-printableURL",  as entries .. first one will be the default forecast.
  "CAZ513|Saratoga|http://forecast.weather.gov/MapClick.php?CityName=Saratoga&state=CA&site=MTR&textField1=37.2639&textField2=-122.022&e=1&TextType=2",
"CAZ513|Los Gatos|http://forecast.weather.gov/MapClick.php?CityName=Los+Gatos&state=CA&site=MTR&textField1=37.2267&textField2=-121.974&e=0&TextType=2",
"CAZ513|Cupertino|http://forecast.weather.gov/MapClick.php?CityName=Cupertino&state=CA&site=MTR&textField1=37.3231&textField2=-122.031&e=0&TextType=2",
"CAZ513|Sunnyvale|http://forecast.weather.gov/MapClick.php?CityName=Sunnyvale&state=CA&site=MTR&textField1=37.3689&textField2=-122.035&e=0&TextType=2",
"CAZ513|Santa Clara|http://forecast.weather.gov/MapClick.php?CityName=Santa+Clara&state=CA&site=MTR&textField1=37.3542&textField2=-121.954&e=0&TextType=2",
"CAZ513|San Jose|http://forecast.weather.gov/MapClick.php?CityName=San+Jose&state=CA&site=MTR&textField1=37.3394&textField2=-121.894&e=0&TextType=2",
"CAZ508|Mountain View|http://forecast.weather.gov/MapClick.php?CityName=Mountain+View&state=CA&site=MTR&textField1=37.3861&textField2=-122.083&TextType=2",
"CAZ529|Santa Cruz|http://forecast.weather.gov/MapClick.php?CityName=Santa+Cruz&state=CA&site=MTR&textField1=36.9742&textField2=-122.03&e=0&TextType=2",
"CAZ006|San Francisco|http://forecast.weather.gov/MapClick.php?CityName=San+Francisco&state=CA&site=MTR&textField1=37.775&textField2=-122.418&e=0&TextType=2",
);

//*/
then the ONE forecast you have configured for Hayes, KS will appear instead.

Also, the Settings.php file is the one used.. there is no settings.php (with a lower-case S) used by the templates.
Linux/*nix servers pay attention to upper/lower case letters in file names .. Windows systems do not.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline DaculaWeather

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3206
    • North Georgia Weather
I think we should all pitch in and make a donation on Ken's site. He's worth every penny we currently pay him!  :grin:

He just got one from me!

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
Ryan shakes Ken's hand. THANKS ALOT that did it for me!!!!
« Last Edit: July 03, 2012, 01:02:21 AM by hayskswx »




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline cospringswx

  • Forecaster
  • *****
  • Posts: 4136
    • Colorado Springs Weather
I think we should all pitch in and make a donation on Ken's site. He's worth every penny we currently pay him!  :grin:

He just got one from me!

Agreed!! He just got one from me too!!




Ryan 

Colorado Springs, CO
www.cospringsweather.com
Davis Vantage Vue
Weather Display Software
Amcrest HD IP Camera

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
He got one from me as well!
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
And me.
Regards, Jerry Wilkins
gwwilk@gmail.com

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Thanks folks!  As I say on the site, the scripts are free for all, and the support of them is my hobby, but it is nice to receive a bit to defray the cost of hosting (and buy a bit of weather stuff now and again :) )
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Cienega32

  • Forecaster
  • *****
  • Posts: 2635
    • East Mesa Weather
My "Thunderstorms" table overrun is fixed.

In this section:
Code: [Select]
        <?php
          
for ($i=0;$i<count($forecasticons);$i++) {
           print 
"<td style=\"width: 11%;\"><span style=\"font-size: 8pt;\">$forecasticons[$i]</span></td>\n";
          }
        
?>


I changed it to this:
Code: [Select]
        <?php
          
for ($i=0;$i<count($forecasticons);$i++) {
 
// fixes tstorms in main forecast page
    
$forecasticons[$i] = preg_replace('|Thunderstorms|','T-storms',$forecasticons[$i]);
           print 
"<td style=\"width: 11%;\"><span style=\"font-size: 8pt;\">$forecasticons[$i]</span></td>\n";
          }
        
?>


I'm sure it ain't proper but it do work for me.

Doesn't seem to validate. Closing slash for '<img src ' seems to not parse?

Pat ~ Davis VP2 6153-Weatherlink-Weather Display-StartWatch-VirtualVP-Win7 Pro-64bit
www.LasCruces-Weather.com   www.EastMesaWeather.com

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
A stupid question. I am using version 2. What do in need to do to fix this issue?

Chuck

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Thanks for the change, Pat.  Unfortunately it didn't improve my forecast.  Where do I get those T-Storms? :grin:

How do we fix the validation failure for the unclosed <img tag that throws 9 errors?
« Last Edit: July 03, 2012, 10:45:50 AM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Dr Obbins

  • Forecaster
  • *****
  • Posts: 1152
Your quick response is much appreciated Ken!  =D&gt;  \:D/

One thing though. The page has a minor validation error.
Code: [Select]
Error Line 699, Column 298: end tag for "img" omitted, but OMITTAG NO was specified

…ce for Measurable Precipitation 40%" ><br />Scattered<br />Thunderstorms</span…



You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2578
    • SouthEast Lincoln, NE Weather
Your quick response is much appreciated Ken!  =D&gt;  \:D/

One thing though. The page has a minor validation error.
Code: [Select]
Error Line 699, Column 298: end tag for "img" omitted, but OMITTAG NO was specified

…ce for Measurable Precipitation 40%" ><br />Scattered<br />Thunderstorms</span…



You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

It appears to be closed in the relevant line of code:
Code: [Select]
                        $t = preg_replace('|<img src="([^"]+)" (border="0") alt="([^"]+)">|i',
                          "<img src=\"\\1\" style=\"border: none;\" alt=\"\\3\" title=\"\\3\" />",$t);
I think the <img line is constructed OK, but maybe one of the 'fixups' after this line, ~415-416, seems to be trashing the end tag?  Does anyone have a fix?  I don't :-?, but I'm sure Ken will.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline Andy Thompson

  • Southern Minnesota Live Weather
  • Forecaster
  • *****
  • Posts: 374
  • Madelia and Thompson Farms
    • Southern Minnesota Live Weather
OK, so that is why the forecast is all screwed up.
Regards,
Andy Thompson
www.somnwx.com



Offline DaculaWeather

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3206
    • North Georgia Weather
My "Thunderstorms" table overrun is fixed.

In this section:
Code: [Select]
        <?php
          
for ($i=0;$i<count($forecasticons);$i++) {
           print 
"<td style=\"width: 11%;\"><span style=\"font-size: 8pt;\">$forecasticons[$i]</span></td>\n";
          }
        
?>


I changed it to this:
Code: [Select]
        <?php
          
for ($i=0;$i<count($forecasticons);$i++) {
 
// fixes tstorms in main forecast page
    
$forecasticons[$i] = preg_replace('|Thunderstorms|','T-storms',$forecasticons[$i]);
           print 
"<td style=\"width: 11%;\"><span style=\"font-size: 8pt;\">$forecasticons[$i]</span></td>\n";
          }
        
?>


I'm sure it ain't proper but it do work for me.

Doesn't seem to validate. Closing slash for '<img src ' seems to not parse?

Great work Pat, your fix has been added to my pages! Thanks a ton!

Offline Cutty Sark Sailor

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 3393
    • Frankfort Weather - TwinHollies WeatherCenter
Great Fix! I made one minor change to 'tidy' my page slightly, Changed the "8pt" style to "9px"...
Code: [Select]
for ($i=0;$i<count($forecasticons);$i++) {
// fixes tstorms in main forecast page
    $forecasticons[$i] = preg_replace('|Thunderstorms|','T-Storms',$forecasticons[$i]);

            print "<td style=\"width: 11%;\"><span style=\"font-size: 9px;\">$forecasticons[$i]</span></td>\n";
          }
which balanced the row a bit...

Sunday night brief power surge totally screwed up the little HP s5510f used as my server... after I finally convinced
it that it actually did have a 'C' drive, and Windows was, in fact, NOT on 'D' drive, I then had this weird, conicidental,
forecast page problem... talk about hair pulling!!!.
Thanks Guys and Gals!
Cheers!
Mike
« Last Edit: July 03, 2012, 08:43:02 AM by Cutty Sark Sailor »
 


Offline ed2kayak

  • Ed
  • Forecaster
  • *****
  • Posts: 613
  • Davis Vantage Pro2 w/12 hr FARS, solar/uv
    • Cumberland Valley Weather
Thanks for TS fix,
I'm getting 9 validation errors also.
Ed
CoCoRaHS PA-CD-6,  Weather Underground KPAMECHA7, CWOP DW5425

 

anything