Settings.php indicates that multi-city forecasts can be set up for WU-forecast V1.26+. Current WU-forecast.php in use is 1.30 (with layout mods).
Have added a number of additional city details but am unable to see any place where the array gets used in wxforecast.php or WU-forecast.php. The list of locations and the array is repeated in WU-forecast.php but should be overwritten by the site settings from settings.php.
I can see there is code which expects a dropdown menu to be created but do not understand exactly how this is done, and, why no such drop down menu appears on the page.
Any assistance appreciated.
Welcome to the Cumulus Support forum.
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Multi-city WU forecasts
Moderator: saratogaWX
- saratogaWX
- Posts: 1185
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Multi-city WU forecasts
It seems that your copy of WU-forecast.php is missing a bunch of code between lines 320 and 322 -- and that is the code that generates the dropdown list of forecast cities available.BCJKiwi wrote:Settings.php indicates that multi-city forecasts can be set up for WU-forecast V1.26+. Current WU-forecast.php in use is 1.30 (with layout mods).
Have added a number of additional city details but am unable to see any place where the array gets used in wxforecast.php or WU-forecast.php. The list of locations and the array is repeated in WU-forecast.php but should be overwritten by the site settings from settings.php.
I can see there is code which expects a dropdown menu to be created but do not understand exactly how this is done, and, why no such drop down menu appears on the page.
Any assistance appreciated.
Code: Select all
// locations added to the drop down menu and set selected zone values
$dDownMenu = '';
for ($m=0;$m<count($WUforecasts);$m++) { // for each locations
list($Nlocation,$Nname) = explode('|',$WUforecasts[$m].'|||');
$seltext = '';
if($haveIndex == $m) {
$FCSTlocation = $Nlocation;
$WU_URL = $Nname;
$seltext = ' selected="selected" ';
}
$dDownMenu .= " <option value=\"$m\"$seltext>".langtransstr($Nlocation)."</option>\n";
}
// build the drop down menu
$ddMenu = '';
// create menu if at least two locations are listed in the array
if (isset($WUforecasts[0]) and isset($WUforecasts[1])) {
if($doRTL) {$RTLopt = ' style="direction: rtl;"'; } else {$RTLopt = '';};
$ddMenu .= '<tr align="center">
<td style="font-size: 14px; font-family: Arial, Helvetica, sans-serif">
<script type="text/javascript">
<!--
function menu_goto( menuform ){
selecteditem = menuform.logfile.selectedIndex ;
logfile = menuform.logfile.options[ selecteditem ].value ;
if (logfile.length != 0) {
location.href = logfile ;
}
}
//-->
</script>
<form action="" method="get">
<p><select name="z" onchange="this.form.submit()"'.$RTLopt.'>
<option value=""> - '.langtransstr('Select Forecast').' - </option>
' . $dDownMenu .
$ddMenu . ' </select></p>
<div><noscript><pre><input name="submit" type="submit" value="'.langtransstr('Get Forecast').'" /></pre></noscript></div>
</form>
</td>
</tr>
';
}
$Force = false;
Code: Select all
// overrides from Settings.php if available
global $SITE;
if (isset($SITE['WUforecasts'])) {$WUforecasts = $SITE['WUforecasts']; }
if (isset($SITE['fcsturlWU'])) {$WU_URL = $SITE['fcsturlWU'];}
if (isset($SITE['fcsticonsdir'])) {$iconDir = $SITE['fcsticonsdir'];}
if (isset($SITE['fcsticonstype'])) {$iconType = $SITE['fcsticonstype'];}
if (isset($SITE['uomTemp'])) {$uomTemp = $SITE['uomTemp'];}
if (isset($SITE['xlateCOP'])) {$xlateCOP = $SITE['xlateCOP'];}
if (isset($LANGLOOKUP['Chance of precipitation'])) {
$xlateCOP = $LANGLOOKUP['Chance of precipitation'];
}
if (isset($SITE['charset'])) {$charsetOutput = strtoupper($SITE['charset']); }
if (isset($SITE['lang'])) {$lang = $SITE['lang'];}
if(isset($SITE['cacheFileDir'])) {$cacheFileDir = $SITE['cacheFileDir']; }
if(isset($SITE['foldIconRow'])) {$foldIconRow = $SITE['foldIconRow']; }
if(isset($SITE['RTL-LANG'])) {$RTLlang = $SITE['RTL-LANG']; }
// end of overrides from Settings.php
Best regards,
Ken
-
- Posts: 1255
- Joined: Mon 09 Jul 2012 8:40 pm
- Weather Station: Davis VP2 Cabled
- Operating System: Windows 10 Pro
- Location: Auckland, New Zealand
- Contact:
Re: Multi-city WU forecasts
Thanks for that.
Humble pie on my part. I did have that code in and took it out ages ago. I had however put it back in but took it out again as it generated some errors. When I got around to posting I overlooked advising you on that - mea culpa!
So I have now updated my modified script (using Diffmerge) to include all the updates.
I still have an issue however.
Wunderground (or the script) seems not to be able to handle city/town names they don't have in their list and this creates a problem in the drop down menu/script.
Have undertaken some analysis and find that while I can get up the right data if I paste the url from the script directly into a browser, it shows a different city name but does show the correct site name and all related data such as lat/long and station ID. A check of what Wunderground actually returns (via IE F12) shows that most of the city name data is for a nearby location but there are a few references to the correct city name (which is the same as the station name so this is probably the station name not the city name) and the correct station ID.
I guess this is because Wunderground don't know the city name (in this case actually a small coastal town - Waikouaiti), but do know about the nearby (20+ kms away down the coast) world reknowned Royal Albatross Centre at Taiaroa Head). If I change the city name in the script to 'Taiaroa Head', the script works without error.
The effect of this issue is to throw errors in all the other locations after the problem one, presumably because the array is out of sync.
So for now I have the 'wrong' location name in the script and everything is working - just have the 'wrong' name in the drop down menu.
Humble pie on my part. I did have that code in and took it out ages ago. I had however put it back in but took it out again as it generated some errors. When I got around to posting I overlooked advising you on that - mea culpa!
So I have now updated my modified script (using Diffmerge) to include all the updates.
I still have an issue however.
Wunderground (or the script) seems not to be able to handle city/town names they don't have in their list and this creates a problem in the drop down menu/script.
Have undertaken some analysis and find that while I can get up the right data if I paste the url from the script directly into a browser, it shows a different city name but does show the correct site name and all related data such as lat/long and station ID. A check of what Wunderground actually returns (via IE F12) shows that most of the city name data is for a nearby location but there are a few references to the correct city name (which is the same as the station name so this is probably the station name not the city name) and the correct station ID.
I guess this is because Wunderground don't know the city name (in this case actually a small coastal town - Waikouaiti), but do know about the nearby (20+ kms away down the coast) world reknowned Royal Albatross Centre at Taiaroa Head). If I change the city name in the script to 'Taiaroa Head', the script works without error.
The effect of this issue is to throw errors in all the other locations after the problem one, presumably because the array is out of sync.
So for now I have the 'wrong' location name in the script and everything is working - just have the 'wrong' name in the drop down menu.
- saratogaWX
- Posts: 1185
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Multi-city WU forecasts
Your list ofBCJKiwi wrote:Thanks for that.
Humble pie on my part. I did have that code in and took it out ages ago. I had however put it back in but took it out again as it generated some errors. When I got around to posting I overlooked advising you on that - mea culpa!
So I have now updated my modified script (using Diffmerge) to include all the updates.
I still have an issue however.
Wunderground (or the script) seems not to be able to handle city/town names they don't have in their list and this creates a problem in the drop down menu/script.
Have undertaken some analysis and find that while I can get up the right data if I paste the url from the script directly into a browser, it shows a different city name but does show the correct site name and all related data such as lat/long and station ID. A check of what Wunderground actually returns (via IE F12) shows that most of the city name data is for a nearby location but there are a few references to the correct city name (which is the same as the station name so this is probably the station name not the city name) and the correct station ID.
I guess this is because Wunderground don't know the city name (in this case actually a small coastal town - Waikouaiti), but do know about the nearby (20+ kms away down the coast) world reknowned Royal Albatross Centre at Taiaroa Head). If I change the city name in the script to 'Taiaroa Head', the script works without error.
The effect of this issue is to throw errors in all the other locations after the problem one, presumably because the array is out of sync.
So for now I have the 'wrong' location name in the script and everything is working - just have the 'wrong' name in the drop down menu.
Code: Select all
$SITE['WUforecasts'] = array(
// Location|forecast-URL (separated by | characters
'Auckland|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-36.910%2C174.771&sp=IAUCKLAN110',
'Tauranga|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-37.661%2C174.169&sp=IBAYOFPL1',
'Taupo|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-38.692%2C176.089&sp=IWAIKATO29',
'Johnsonville|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-41.215%2C174.809&sp=IWELLING38',
'Wellington|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-41.291%2C174.786&sp=IWELLING33',
'Dunedin|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-45.875%2C170.478&sp=IOTAGODU6',
'Tairoa Head|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-45.614%2C170.638&sp=IOTAGODU7',
//'Waikouaiti|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=-45.614%2C170.638&sp=IOTAGODU7',
'Kildimo|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=52.638%2C-8.796&sp=ILIMERIC2',
'Mallow|http://www.wunderground.com/cgi-bin/findweather/getForecast?query=52.108%2C-8.796&sp=ICOCORKM2',
);
I'd suggest you set the first field to match what WU has as the title for that forecast so both the dropdown and the display will match.
Keep in mind that if the URL changes (or the number in the array changes), the cache file associated with the entry may not be refreshed until 30 minutes later (due to cache timeout), so the revised entry may display 'old cache' data for the one selected.
You can force a cache refresh on the changed one by appending &force=1 to the URL after the ?z=N . So
?z=1&force=1 will refresh the first entry in the list, etc.
Best regards,
Ken
-
- Posts: 1255
- Joined: Mon 09 Jul 2012 8:40 pm
- Weather Station: Davis VP2 Cabled
- Operating System: Windows 10 Pro
- Location: Auckland, New Zealand
- Contact:
Re: Multi-city WU forecasts
Thanks for that Ken.
Yes the options have settled down somewhat now that the cache has cleared.
However it still seems that WU just picks the nearest 'city' name to the lat/long it can find (that it knows about) and puts that at the end of the title (in the local language).
Acordingly I have taken the city name off the title as it is displayed in the drop down menu above. That way it looks as one (well I ) would expect.
I guess this is not an issue in countires where many more city names are in thier database.
Thanks again.
Yes the options have settled down somewhat now that the cache has cleared.
However it still seems that WU just picks the nearest 'city' name to the lat/long it can find (that it knows about) and puts that at the end of the title (in the local language).
Acordingly I have taken the city name off the title as it is displayed in the drop down menu above. That way it looks as one (well I ) would expect.
I guess this is not an issue in countires where many more city names are in thier database.
Thanks again.