cloudy

Author Topic: RSS advisory - new version 1.05 - new features  (Read 2770 times)

0 Members and 1 Guest are viewing this topic.

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
RSS advisory - new version 1.05 - new features
« on: January 22, 2008, 04:39:25 PM »
I collaborated with Ken True and came up with some new features for the NOAA RSS Advisory PHP script

New 27-Jan-2008:
The script has been greatly improved and we've reissued the script as
'rss-advisory.php' .

New features include:
* accommodates a different CSS style for when there is no advisory,
* added the sample CSS (see settings notes),
* added 'invalid zone' error code
* added option to lowercase the advisories
See comments in the code for more examples and descriptions.

http://saratoga-weather.org/scripts-rss.php#NOAARSS

« Last Edit: January 29, 2008, 04:01:39 PM by MCHALLIS »

Offline saratogaWX

  • Posts: 4,556
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
    • Saratoga Weather
Re: RSS advisory gateway timeout - graceful error fix
« Reply #1 on: January 22, 2008, 05:21:04 PM »
Sweet!  Thanks very much Mike!  That's a great enhancement.

I've updated rss-advisory-test-c.php to V1.04 with these changes.

Thanks again!

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: RSS advisory gateway timeout - graceful error fix
« Reply #2 on: January 22, 2008, 05:26:01 PM »
Sweet!  Thanks very much Mike!  That's a great enhancement.

I've updated rss-advisory-test-c.php to V1.04 with these changes.

Thanks again!

Best regards,
Ken

I forgot to mention it has a feature to put the full XML error in the no print tag so if you view the source of your page during an error you might find more information about the actual error.

Offline saratogaWX

  • Posts: 4,556
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
    • Saratoga Weather
Re: RSS advisory gateway timeout - graceful error fix
« Reply #3 on: January 28, 2008, 03:20:49 AM »
Thanks to Mike's efforts, we've updated the script, and renamed it to 'rss-advisory.php' to help folks keep the names straight.  :D

This new version (V1.05) includes Mike's graceful formatting of XML errors, is XHTML 1.0-Strict output, and includes a new method to include it in the page.  Also included is an option to lowercase the NOAA advisory output.

Thanks again to Mike (mchallis) for all his efforts on refining the script!!

Download from http://saratoga-weather.org/scripts-rss.php#NOAARSS

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: RSS advisory gateway timeout - graceful error fix
« Reply #4 on: January 28, 2008, 05:01:25 AM »
Thanks Ken

Here is a sample of my site using the new feature I call "CSS style switch for no advisory / advisory"

I prefer not to have a yellow or red box when there is no advisory. I use just a white dashed outlined box when there is no advisory.
If you use this new feature on this version be sure to note that it is called slightly differently for PHP page include use.
see include option samples in the settings section of the code, and put the included sample css in your web page css file

see the attached photos:
« Last Edit: January 28, 2008, 05:07:22 AM by MCHALLIS »

Offline andro700

  • Chuck
  • Posts: 3,208
  • Watford City, North Dakota
    • Chuck's Weather Page
Re: RSS advisory - new version 1.05 - new features
« Reply #5 on: February 11, 2008, 11:22:24 PM »
I just downloaded version 1.06 and was trying to get the box to appear. I probably have some thing wrong. Here is a snippet of the code. I have the css pasted in my css page. Any help would be greatly appreciated.

Chuck

Code: [Select]
<div id="content">
  <h1 id="pageName">Current Weather Conditions Glendive, Montana</h1>
        <div class="story">
      <div class="advisorybox" style="width: 610px;">
   <?php include("http://www.chucksweather.com/rss-advisory.php?&inc=Y&summary=Y;detailpage=NOAA-advisory2.php");
     if (
preg_match("|There are no active|i",$advisory_html) ||
     
preg_match("|Advisory Information Unavailable|i",$advisory_html)) {
       echo 
'<div class="advisoryBoxnoactive">' .$advisory_html .'</div>';
 }else{
       echo 
$advisory_html;
 } 
?>

    </div>

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: RSS advisory - new version 1.05 - new features
« Reply #6 on: February 12, 2008, 12:01:44 AM »
Chuck,

You are missing the noprint parameter. Because you want it to echo(print) $advisory_html here in the output after it has been included and not printed from inside the script.
Also for the 'CSS style switch for no advisory / advisory' to work the divs have to be this way in my example.

Try this:

Code: [Select]
<div id="content">
  <h1 id="pageName">Current Weather Conditions Glendive, Montana</h1>
        <div class="story">

   <?php 
include 'http://www.chucksweather.com/rss-advisory.php?inc=Y&summary=Y&noprint=1&detailpage=NOAA-advisory2.php';
if (
preg_match("|There are no active|i",$advisory_html) || preg_match("|Advisory Information Unavailable|i",$advisory_html)) {
       echo 
'<div class="advisoryBoxnoactive">' .$advisory_html .'</div>';
 }else{
       echo 
'<div class="advisoryBox">' $advisory_html .'</div>';
 }
?>



Offline andro700

  • Chuck
  • Posts: 3,208
  • Watford City, North Dakota
    • Chuck's Weather Page
Re: RSS advisory - new version 1.05 - new features
« Reply #7 on: February 12, 2008, 12:57:38 AM »
I applied what you sent me but the box is blank. Is it supposed to be that way.

Chuck

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: RSS advisory - new version 1.05 - new features
« Reply #8 on: February 12, 2008, 01:09:03 AM »
No it is not supposed to be blank.
Some servers do not support http URL includes

Try including using the the FILE method like this:

Code: [Select]
  <?php 
$_REQUEST
['inc'] = 'Y';
$_REQUEST['summary'] = 'Y';
$_REQUEST['noprint'] = 1;
include 
'rss-advisory.php';

if (
preg_match("|There are no active|i",$advisory_html) || preg_match("|Advisory Information Unavailable|i",$advisory_html)) {
       echo 
'<div class="advisoryBoxnoactive">' .$advisory_html .'</div>';
 }else{
       echo 
'<div class="advisoryBox">' $advisory_html .'</div>';
 }
?>



Offline andro700

  • Chuck
  • Posts: 3,208
  • Watford City, North Dakota
    • Chuck's Weather Page
Re: RSS advisory - new version 1.05 - new features
« Reply #9 on: February 12, 2008, 01:18:18 AM »
Here is what I am getting now. Is there something I may have missed in my rss-advisory page?

Code: [Select]
Advisory Information Unavailable, error reading RSS Data saved from the NOAA advisories server.
I appreciate the help.

Chuck

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: RSS advisory - new version 1.05 - new features
« Reply #10 on: February 12, 2008, 01:28:20 AM »
Is this the page?

http://www.chucksweather.com/index2.php

It is working now

Offline andro700

  • Chuck
  • Posts: 3,208
  • Watford City, North Dakota
    • Chuck's Weather Page
Re: RSS advisory - new version 1.05 - new features
« Reply #11 on: February 12, 2008, 01:43:53 AM »
Yes it is. Only one little thing is the box is indented on one side and not on the other. Trying to figure out how to change it.

Chuck

Offline MCHALLIS

  • Posts: 2,102
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: RSS advisory - new version 1.05 - new features
« Reply #12 on: February 12, 2008, 01:53:32 AM »
Yes it is. Only one little thing is the box is indented on one side and not on the other. Trying to figure out how to change it.

Chuck

your style css...
change;

.story{
   clear: both;
   padding: 10px 0px 0px 10px;
   font-size: 100%;
}

to ..

.story{
   clear: both;
   padding: 0px 0px 0px 0px;
   font-size: 100%;
}

you could also add some width to your advisory boxes CSS if you want

  width: 720px;
« Last Edit: February 12, 2008, 01:56:25 AM by MCHALLIS »

Offline andro700

  • Chuck
  • Posts: 3,208
  • Watford City, North Dakota
    • Chuck's Weather Page
Re: RSS advisory - new version 1.05 - new features
« Reply #13 on: February 12, 2008, 02:25:05 AM »
Thanks for the advice. I have been up about 28 hours and a bit tired here and can not think straight. I should have known that.

Many Thanks,
Chuck

Applied looks great. Thanks again.
« Last Edit: February 12, 2008, 02:28:22 AM by andro700 »

Offline delmarvawx

  • Posts: 1
Re: RSS advisory - new version 1.05 - new features
« Reply #14 on: March 06, 2010, 05:01:08 PM »
hey i noticed with this script you only get warnings for counties. i was wondering if its possible to get the entire CONUS information for my site Analystwx.com

 

cumulus