Author Topic: Canada/Meteobridge Advisory page problems  (Read 1419 times)

0 Members and 1 Guest are viewing this topic.

Offline chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Canada/Meteobridge Advisory page problems
« on: September 27, 2017, 08:30:41 AM »
Hi Ken,


Having an issue with the Advisory (wxwarnings.php) page.  Upon entering the page, we are presented with the list of warnings in red followed by a map of Canada showing the warnings. 


Further down  the page is the map of Southern Ontario showing the areas with warnings. 


If we click on the map of Canada on one of the warning areas, we are taken to the Environment Canada site Alerts page.  However, if we click on one of the warnings links at the top of the page, both maps disappear, the header in blue above the Southern Ontario map collapses up to just below all the warnings links and displays the title of the County level warnings list, and a line of text appears centered below the title, in yellow, saying "A valid location ID code is required".  Same thing happens if I click on one of the counties that are red (have active warnings) on the Southern Ontario map.


Cheers!


Chris

« Last Edit: September 27, 2017, 08:32:34 AM by chrisgrainger »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #1 on: September 27, 2017, 11:53:23 AM »
Hi Chris,
I think the wxadvisory.php script is not being fed by a script that I've authored -- the 'stock' Canada wxadvisory.php page is fed from the $alertstring from ec-forecast.php by
Code: [Select]
<?php 
 $doInclude    = true// handle ec-forecast and WXSIM include also
 $doPrint    = false//  ec-forecast.php setting
 include_once($SITE['fcstscript']);
 if ($alertstring <> '') { 
 print $alertstring// will produce alert box with link if advisories found
 } else { 
 print "<p class=\"advisoryBox\">".langtransstr("No watches or warnings in effect for").$title.</p>\n"
 }
?>

on the page.

What is the script that is driving your wxadvisory.php page?
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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #2 on: September 27, 2017, 01:55:41 PM »
Well now.....


Let me wash the egg off my face and go have a look.   :oops:

Offline chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #3 on: September 27, 2017, 02:22:48 PM »
Okaaaayyyy...


I don't know where I got this particular file.  The filedate is December 24, 2013.  The top of the file looks like this....


Code: [Select]
############################################################################
# A Project of TNET Services, Inc. and Saratoga-Weather.org (WD-Canada-ML template set)
############################################################################
#
#   Project:    Sample Included Website Design
#   Module:     wxadvisory.php
#   Purpose:    Watches/Warnings/Advisories Page
#   Authors:    Kevin W. Reed <kreed@tnet.com>
#               TNET Services, Inc.
#
#    Copyright:   (c) 1992-2007 Copyright TNET Services, Inc.
############################################################################
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
############################################################################
#   This document uses Tab 4 Settings
############################################################################


If it was a page that I added, I would have used the wxnewpage.php template and this is not that page.  And this is obviously not the wxadvisory page included in the template set.  The only thing left is that I cut and pasted code but I would have left the original and commented it out.  Guess in this case I didn't....


I'll keep looking and see if I can find where I got it from.  Sorry to have bugged you.


Cheers!


Chris
« Last Edit: September 27, 2017, 02:24:43 PM by chrisgrainger »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #4 on: September 27, 2017, 02:57:06 PM »
Chris, it's no problem.. just .zip up the page and post it.  I'll take a look.
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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #5 on: September 27, 2017, 03:13:46 PM »
Hi Ken,


Here is the page.  I've put the template page back in it's place.  Appreciate you having a boo.


Cheers!


Chris

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #6 on: September 27, 2017, 03:32:13 PM »
Hi Chris,
Looks like the problem lies in ec-rss-top-warning.php -- .zip that one up and post it please...
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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #7 on: September 27, 2017, 03:44:39 PM »
Here you go.  There was also a file ec-rss-top-warningSB that I included

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #8 on: September 27, 2017, 04:43:06 PM »
I do recognize some of the 'bones' of those scripts .. they were based on my earlier RSS decoder for the NWS and adapted by Jim McMurry and George Fodi for use with the EC.

So, there were multiple changes needed, but most importantly, the zone of 'on10' had to be changed to 'on-66' to match the real name of the XML file that was being parsed.  I updated the URL used (so it matches the "Alerts" RSS URL on the forecast page for your location) and replaced the fetching function with the new cURL based script for https support.

Here's your modded versions :)

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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #9 on: September 27, 2017, 06:30:37 PM »
I do recognize some of the 'bones' of those scripts .. they were based on my earlier RSS decoder for the NWS and adapted by Jim McMurry and George Fodi for use with the EC.

So, there were multiple changes needed, but most importantly, the zone of 'on10' had to be changed to 'on-66' to match the real name of the XML file that was being parsed.  I updated the URL used (so it matches the "Alerts" RSS URL on the forecast page for your location) and replaced the fetching function with the new cURL based script for https support.

Here's your modded versions :)
Thanks very much, Ken.  Unbelievable that you take the time to work on code that someone else modded. Above and beyond.

Cheers!

Chris

Sent from my SM-G935W8 using Tapatalk


Offline chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #10 on: September 28, 2017, 09:05:25 AM »
Hey Ken,


I downloaded the zip this morning and opened it up.  It contains just the ec-rss scripts.  No changes to wxadvisory.php needed?


Cheers!


Chris

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #11 on: September 28, 2017, 09:11:21 AM »
Just the ec-rss-* scripts needed changes :)
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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #12 on: September 28, 2017, 10:01:32 AM »
Just the ec-rss-* scripts needed changes :)
Thanks again, Ken.

Sent from my SM-G935W8 using Tapatalk


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #13 on: September 28, 2017, 10:37:02 AM »
Your page is getting a small cache error
Quote
<!-- unable to write ./ECalerts/warn/ec-rss-advisory-on-66.txt -->

Make sure you have a ./ECalerts/warn directory on your website.

You're welcome :)
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 chrisgrainger

  • Contributor
  • ***
  • Posts: 122
    • Top of The Rideau
Re: Canada/Meteobridge Advisory page problems
« Reply #14 on: September 28, 2017, 11:10:20 AM »
Done....


BTW... how do I check for that sorta stuff? 

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Canada/Meteobridge Advisory page problems
« Reply #15 on: September 28, 2017, 11:19:39 AM »
For all my scripts (and for many of the other author's scripts), using view-source on the page in question reveals the diagnostics in HTML comments.

For example, your wxadvisory.php page shows
Quote
<!-- Data folder ./ECalerts/warn/ created -->
<!-- ec-rss-top-warning.php - V2.06 10-Apr-2014 -->
<!-- getting cache from https://weather.gc.ca/rss/warning/on10_e.xml -->
<!-- curl fetching 'https://weather.gc.ca/rss/warning/on10_e.xml' -->
<!-- HTTP stats:  RC=404 dest=205.189.10.44 port=443 (from sce=69.89.31.136)
      Times: dns=0.017 conn=0.106 pxfer=0.311 get=0.086 total=0.397 secs -->
<!-- headers:
HTTP/1.1 404 Not Found
Date: Thu, 28 Sep 2017 15:13:22 GMT
Server: Apache
Vary: Accept-Encoding
X-UA-Compatible: IE=Edge
Content-Length: 3778
Content-Type: text/html
 -->
<!-- unable to write ./ECalerts/warn/ec-rss-advisory-on10.txt -->

so.. there's still a problem with writing to the ./ECalerts/warn directory.  Make sure that directory exists under your document root, and that it has permissions of 755 or 766 for the directory so it can be written by PHP.
Additionally 'on10' is not valid (the 404 shows that).  Change to 'on-66' for your specific warnings.
https://weather.gc.ca/rss/warning/on-66_e.xml is the URL for warnings for Westport, ON

Running check-fetch-times.php?show=info on your site shows
Quote
Settings.php Cache file directory in $SITE['cacheFileDir']='./cache/' exists, with permissions=drwxr-xr-x [0755]
..Wrote 104 bytes to ./cache/test.txt successfully, then deleted test file. Cache directory is fully functional.
so permission 755 is sufficient on the ECalerts/warn directory.

Also, running any of my template pages (or scripts) with ?debug=y and a view-source shows a LOT more diagnostic information in HTML comments -- very useful for (remote) debugging :)
« Last Edit: September 28, 2017, 11:24:30 AM by saratogaWX »
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