Author Topic: php advisory help  (Read 2989 times)

0 Members and 1 Guest are viewing this topic.

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
php advisory help
« on: May 26, 2009, 01:39:24 PM »
I am using Ken's advisory script. I have everything working good except the page that should show the details of the advisory/warning. It is at

www.leomaweather.com/rss-advisory.php

Could someone take a look at it for me please?


Offline sam2004gp

  • Mount Crawford, Virginia
  • Forecaster
  • *****
  • Posts: 2865
  • Weeeeeeeee!!!!
    • Mount Crawford Weather, VA
Re: php advisory help
« Reply #1 on: May 26, 2009, 01:51:00 PM »
It shows as blank to me.
SAM --->>> http://www.mountcrawfordweather.org
OS WMR-968 with a Dedicated PWS Weather Computer running VWS v13.01 p09


Offline mackbig

  • Forecaster
  • *****
  • Posts: 4128
    • Mackie's Main Street, Unionville, ON Canada Weather
Re: php advisory help
« Reply #2 on: May 26, 2009, 02:44:39 PM »
maybe its blank, cause there are no warnings? 

Different script, but when I setup ken's ec-forecast script (which include enviro canada weather warnings) I had to change it to a county that had warnings somewhere in Canada for testing, then put it back to mine after I knew it was working.

Andrew

Andrew - Davis VP2+ 6163, serial weatherlink, wireless anemometer, running Weather Display.  Boltek PCI Stormtracker, Astrogenic Nexstorm, Strikestar - UNI, CWOP CW8618, GrLevel3, (Station 2 OS WMR968, VWS 13.01p09), Windows 7-64

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php advisory help
« Reply #3 on: May 26, 2009, 03:31:20 PM »
Hmmm... it shows blank because the content of the page is blank
Code: [Select]
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Advisory</title>



</head>

<body>


  

</body>

</html>

What is the name of the rss-advisory.php script on your site?  It's not being invoked by the page named 'rss-advisory.php'.  BTW.. your page invoking the script should be named 'advisory.php' (or anything but 'rss-advisory.php') since a page can't invoke itself that way (leads to a 500 Server Error due to a recursive include).

Last note... don't use Frontpage to edit PHP scripts.. It will generally screw them up in strange ways .. use frontpage for your site (if you must), but use notepad to edit PHP scripts (or PHP pages) .. it's just safer :)

Best regards,
Ken
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 LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: php advisory help
« Reply #4 on: May 26, 2009, 07:28:28 PM »
This is the script that I added using Notepad to the page that I want to show the details on. I do need to change the page name because it is named rss-advisory.php. The script below does not show up even though it is on there when I upload it to the server.  Should the script be in the head or the body of the page? The other page with the summery is www.leomaweather.com/home.php

Ken, is it ok if I send you the files that this script is running on? If so It will be late tonight before I get home.

<?php
$includeOnly = true;
$DefaultZone = 'WAZ021';
$doSummary = false;
include_once("rss-advisory.php");
?>

Note I start my pages with Frontpage but do all the php in Notepad.
« Last Edit: May 26, 2009, 07:31:15 PM by LeomaTNWX »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php advisory help
« Reply #5 on: May 26, 2009, 09:18:04 PM »
The code you showed

<?php
$includeOnly 
true;
$DefaultZone 'WAZ021';
$doSummary false;
include_once(
"rss-advisory.php");
?>
 

will work fine on a page on your site, as long as that page is NOT named rss-advisory.php.

The rss-advisory.php page should be based only on the source from http://saratoga-weather.org/rss-advisory.php?sce=view.

You should change (in the page with the include_once("rss-advisory.php") the $DefaultZone value to your zone in Tennessee (the sample you showed was for a zone in Washington state).

Let me outline what's needed:
1) create a page (call it advisory.php) using Frontpage if you like.
2) edit the advisory.php page (with notepad) to insert the PHP snippet above (with a changed value for $DefaultZone)
3) download rss-advisory.php from my site (URL above) and upload it unchanged to your website.
4) upload your advisory.php page to your website.

Then you should be able to see the full results in your template page by viewing advisory.php on your website.

Best regards,
Ken
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 LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: php advisory help
« Reply #6 on: May 26, 2009, 09:21:19 PM »
Thanks Ken. I will make the changes as soon as I get home tonight. What would you use to replace Frontpage with? I am new to HTML.

Offline SLOweather

  • Global Moderator
  • Forecaster
  • *****
  • Posts: 3456
    • Weatherelement Moline IL
Re: php advisory help
« Reply #7 on: May 26, 2009, 11:27:50 PM »
Kompozer is a fairly useful, free WYSIWYG HTML authoring tool.

Even when directly editing HTML in Notepad or Notepad2, I sometimes use Komposer to make quick blocks of HTML for tables and such. I make it in Komposer, and then copy the applicable source and paste into whatever I'm working on.

Notepad2 is as simple and easy as MS's Notepad, with the bonus of syntax highlighting which makes some editing easier.

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: php advisory help
« Reply #8 on: May 27, 2009, 01:41:21 PM »
Ken I did what you said but when there is a advisory from NOAA it says"Advisory Information Unavailable, error reading cache file saved from the NOAA advisories server." on my the advisory page.

And the link on the summery page just links back to the same page.

What do I need to do to fix this?

www.leomaweather.com/advisory.php

www.leomaweather.com/home.php

Thanks

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php advisory help
« Reply #9 on: May 28, 2009, 02:42:34 PM »
You're getting closer :)

Now the advisory.php page is in fact working (calling rss-advisory.php correctly).

If you do a view-source on the advisory.php page, you'll see
Quote
<!-- advisory.php - V1.09 25-Mar-2008 -->
<!-- getting cache from http://www.weather.gov/alerts/wwarssget.php?zone=TNZ094 -->
<!-- GET /alerts/wwarssget.php?zone=TNZ094 HTTP/1.0
      Host: www.weather.gov -->
<!-- Time to fetch: 0.273 sec -->
<!-- unable to write rss-advisory-TNZ094.txt -->

<!-- Zone='TNZ094' -->
which just indicates that the cache file (named 'rss-advisory-TNZ094.txt') is not writable.  So..

1) create a 'rss-advisory-TNZ094.txt' file using notepad (just put one space in the file and save it).
2) upload the file to your website (same directory as rss-advisory.php is in)
3) use the cPanel on your website to change the permissions on the file to 666 or 777 so it is writable by PHP
4) run http://www.leomaweather.com/rss-advisory.php?cache=refresh once to load the cache

the check http://www.leomaweather.com/advisory.php to make sure it shows the data correctly.

Best regards,
Ken
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 LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: php advisory help
« Reply #10 on: May 29, 2009, 02:43:23 PM »
I got it!!!! :grin: Thanks Ken for the learning experience. Now if I can just remember it for the next time.

Thanks again.

Offline LeomaTNWX

  • Senior Contributor
  • ****
  • Posts: 271
    • Leoma, Tn Weather
Re: php advisory help
« Reply #11 on: June 03, 2009, 02:10:37 PM »
The script is working fine but the link on my home page (when there is an advisory etc.) does not link to my details page(advisory.php). What do I need to change to make the link work?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: php advisory help
« Reply #12 on: June 03, 2009, 06:29:28 PM »
Change the script on your homepage to read

Code: [Select]
<?php
$includeOnly 
true;
$DefaultZone 'TNZ094';
$doSummary true;
$hurlURL 'advisory.php';
include_once(
"rss-advisory.php");
?>
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