Forecasts for Multiple Locations

The advforecast2.php file has been updated to handle forecasts for multiple locations.

This is very useful with micro-climates in your area or if you want to expand the forecast range.
It can be used as standalone page or for templates like the Carter Lake set.

Available at Saratoga-Weather.org
Standalone use: http://saratoga-weather.org/scripts-carterlake.php#advforecast
Template use: http://saratoga-weather.org/wxtemplates/updates.php

And thanks to you Curly for the coding on which this update is based! It was great collaborating with you on this.

Best regards,
Ken

Thank you Curly and Ken for another excellent script addition!!!

John

Not getting the drop down menu…ideas?

// ----------------------SETTINGS---------------------------------------------

// V3.00 -- this following array can be used for multiple forecasts in standalone mode
//  for template use, add a $SITE['NWSforecasts'] entry in Settings.php to have these entries.
 
/*
$NWSforecasts = array(
 // ZONE|Location|point-forecast-URL  (separated by | characters
 
 'OKZ046|Ardmore|http://forecast.weather.gov/MapClick.php?CityName=Ardmore&state=OK&site=OUN&textField1=34.1907&textField2=-97.1197&e=0&TextType=2',
 'OKZ041|Davis|http://forecast.weather.gov/MapClick.php?CityName=Davis&state=OK&site=OUN&textField1=34.4809&textField2=-97.1305&e=0&TextType=2',
 'OKZ046|Healdton|http://forecast.weather.gov/MapClick.php?CityName=Healdton&state=OK&site=OUN&textField1=34.2335&textField2=-97.4868&e=0&TextType=2',
 'OKZ051|Madill|http://forecast.weather.gov/MapClick.php?CityName=Madill&state=OK&site=OUN&textField1=34.0915&textField2=-96.7723&e=0&TextType=2',
 'OKZ050|Marietta|http://forecast.weather.gov/MapClick.php?CityName=Marietta&state=OK&site=OUN&textField1=33.9339&textField2=-97.1233&TextType=2',
 'OKZ045|Ringling|http://forecast.weather.gov/MapClick.php?CityName=Ringling&state=OK&site=OUN&textField1=34.1767&textField2=-97.5904&e=0&TextType=2',
 'OKZ041|Sulpher|http://forecast.weather.gov/MapClick.php?CityName=Sulphur&state=OK&site=OUN&textField1=34.5067&textField2=-96.977&e=0&TextType=2',
 'OKZ047|Tishomingo|http://forecast.weather.gov/MapClick.php?CityName=Tishomingo&state=OK&site=OUN&textField1=34.2391&textField2=-96.6789&e=0&TextType=2',
 'OKZ012|Wynnewood|http://forecast.weather.gov/MapClick.php?CityName=Wynnewood&state=OK&site=OUN&textField1=34.6443&textField2=-97.1617&e=0&TextType=2'
); 
//*/

//
 $NOAAZone = 'OKZ046';  // change this line to your NOAA warning zone.
// set $fileName to the URL for the point-printable forecast for your area
 $fileName = "http://forecast.weather.gov/MapClick.php?CityName=Ardmore&state=OK&site=OUN&textField1=34.1907&textField2=-97.1197&e=0&TextType=2";//
$iconDir = './forecast/images/';
$cacheFileDir = './';      // default cache file directory
// ----------------------END OF SETTINGS--------------------------------------

http://www.ardmoreweatherlive.com/wx2.php
http://www.ardmoreweatherlive.com/advforecast2.php

Thanks for any help on this, Doug

Yep… simple. The default $NWSforecasts array in the distribution is actually inside a multi-line comment (deliberately) so it would work with all the single-forecast configurations without change. To enable the multi-forecast inside the script (when you aren’t using the AJAX/PHP template set), just change

/*
$NWSforecasts = array(

to

//*
$NWSforecasts = array(

and the array as you have it will be defined, and your dropdown list will be produced :slight_smile:

Best regards,
Ken

Thanks again…you got me going

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.