This version is a MAJOR rewrite of the script (originally released in 2006) and changes the way the data is acquired -- no longer will it be subject to the whims of the Environment Canada webmasters who seem to delight in minor tweaks to the page HTML. Instead, this script relies on the XML data provided by the EC via http://dd.weather.gc.ca/citypage_weather/xml/ site, and that XML data format has been stable for many years.
The main issue to overcome was how to seamlessly convert the existing EC website URLs used in V1-V4 of the script to the XML data file URLs needed for the actual data. That was solved by a new lookup table (ec-forecast-lookup.txt) that (along with a new function call) will do that conversion. So, ec-forecast-lookup.txt is now REQUIRED to be in the same directory as the ec-forecast.php script for proper operation.
Some new features with this release:
1) the * indicator for abnormal temperature is back and appears after the Min or Max temperature in the icon display.
2) a new Averages and Extremes table is now produced (in $almanac string).
3) a new 24-hour hourly forecast table is now produced (in $forecast24h string).
4) new settings control the display of the Averages and Extremes and the 24-hour forecast table. In Settings.php these can be used:
$SITE['ECshowConditions'] = true; // set to false to disable Conditions display box
$SITE['ECshowAlmanac'] = true; // set to false to disable Almanac (Averages/Extremes) display box
$SITE['ECshow24hour'] = true; // set to false to disable 24-hour hourly forecast display box
In a calling script, the variables:
$doShowConditions, $doShowAlmanac, $doShow24hour will override the above.
The HTML for almanac is returned in $almanac and the 24-hour hourly forecast is returned in the $forecast24h string.
I'm hoping that the shift to using XML will put an end to the frequent updates to this script as we'll no longer depend on the raw HTML of the EC website
Standalone: download from the script page note: download ec-forecast-lookup.txt too!
Saratoga template: use the update tool page with a query for Base-Canada, Plugin-*, 27-Sep-2017
Thanks to all the testers who provided feedback with the V5.00 beta!!
Discussion of Ken True's web site templates
1 post • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests