cloudy

Author Topic: NEW Air Quality Script for Carterlake Template (RSS Version)  (Read 8480 times)

0 Members and 1 Guest are viewing this topic.

mth

  • Guest
Air Quality addon page for the WD-AJAX-PHP-USA template set are now available.

This script will provide your site with the current Air Quality Index, Pollutant Details, and the Two-Day AQI Forecast.  This script utilizes the RSS feeds provided by http://feeds.enviroflash.info/ (airnow.gov).  The script is also XHTML 1.0 Transitional.

Also included is an additional script to provide your front page (ajax-dashboard) with the current AQI.

The page can be seen in action at http://www.relayweather.com/wxaqirss.php
The dashboard aqi can be seen in action at http://www.relayweather.com/
The files are available at http://www.relayweather.com/downloads.php

These scripts were written when the airnow.gov site made some dramatic changes to their code.  The old code is broken so this new script is needed.  Hopefully, the RSS version will stay consistent.  


Enjoy!   :)

Michael
http://www.relayweather.com



13-Jul-10 - UPDATE to Script:
Sorry for the update so soon....a few bugs were brought to my attention today.  (Thanks Chris! Smile)
--  The script has been updated to incorporate the ability for the script to handle missing data/days in both the Air Quality 2-Day Forecast and the Realtime Air Quality Data.  Missing data will now display "N/A".
-- The script now shows the "Action Alert Day" status.

16-Jul-10 - UPDATE to Script:
--  The script has been updated to fix a bug introduced when there is no second day forecast.  On some occasions, the Forecast Agency and Last Update time would mistakenly display N/A.
« Last Edit: September 09, 2010, 11:25:33 PM by mth »

Blackjack52

  • Guest
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #1 on: July 11, 2010, 11:46:41 PM »
Thank you very much.

mth

  • Guest
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #2 on: July 11, 2010, 11:53:30 PM »
No problem Lee....I think this script will prove to be a little more robust.  :)

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #3 on: July 12, 2010, 12:23:04 AM »
Running. Thanks.

mth

  • Guest
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #4 on: July 12, 2010, 12:24:17 AM »
Running. Thanks.

Looks great Tim....

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #5 on: July 12, 2010, 12:35:34 AM »
When I try to include the dashboard piece I get the following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in /homepages/24/d87962498/htdocs/get-aqi-rss.php5 on line 22

I renamed the file to php5 so it would get processed that way but that did not help.

Offline saratogaWX

  • Posts: 4,672
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
    • Saratoga Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #6 on: July 12, 2010, 12:47:06 AM »
Thanks, Michael!  :)

I've installed the aqi page on my site.  Nice enhancement!!

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

Offline weatherbee

  • Posts: 577
  • Sherman, Ct.
    • http://www.shermanctweather.com
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #7 on: July 12, 2010, 12:53:10 AM »
Michael,
Thanks so much.  I have it running on it's own page and the dashboard page.
Sony Pentium 4, 1.6 GHZ,512 MB Ram, Windows XP Pro, SP2

mth

  • Guest
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #8 on: July 12, 2010, 02:41:07 AM »
When I try to include the dashboard piece I get the following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in /homepages/24/d87962498/htdocs/get-aqi-rss.php5 on line 22

I renamed the file to php5 so it would get processed that way but that did not help.

Tim,

My apologies but I'm not sure what coulding be causing that error.  Maybe someone on the forum more familiar with PHP5 issues can assist.  Have you always had problems with some of the scripts?

Michael

Offline BigOkie

  • Posts: 623
  • Tulsa, OK
    • East Tulsa (Douglas)
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #9 on: July 12, 2010, 04:41:15 AM »
Tim,

My apologies but I'm not sure what coulding be causing that error.  Maybe someone on the forum more familiar with PHP5 issues can assist.  Have you always had problems with some of the scripts?

Michael

Look over this and tell me is this line 22?
Code: [Select]
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,

Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #10 on: July 12, 2010, 02:02:13 PM »
When I try to include the dashboard piece I get the following error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in /homepages/24/d87962498/htdocs/get-aqi-rss.php5 on line 22

I renamed the file to php5 so it would get processed that way but that did not help.


It seems like from your error being received...perhaps you are missing a ")"  symbol somewhere when you copied the code to your dashboard file.



...chris

Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #11 on: July 12, 2010, 02:09:34 PM »
hello..

I have the script running on my site, but no data appears for 2nd day forecast. I went to the page here:

http://www.airnow.gov/index.cfm?action=airnow.local_state


...and noticed many cities/towns in the state are also not displaying any 2nd day forecast, so i then went to other State choice and same issue with many towns/cities.

any idea if this is an ongoing issue?..or do they release the forecast for day2 later in the day, since it is early morning now here?

if it is not regularly going to display the 2nd days data...perhaps we need to eliminate that part of it from our pages/files?

my actual aqi page is here:

http://www.gateway2capecod.com/wxaqirss.php


...chris


mth

  • Guest
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #12 on: July 12, 2010, 02:20:14 PM »
hello..

I have the script running on my site, but no data appears for 2nd day forecast. I went to the page here:

http://www.airnow.gov/index.cfm?action=airnow.local_state


...and noticed many cities/towns in the state are also not displaying any 2nd day forecast, so i then went to other State choice and same issue with many towns/cities.

any idea if this is an ongoing issue?..or do they release the forecast for day2 later in the day, since it is early morning now here?

if it is not regularly going to display the 2nd days data...perhaps we need to eliminate that part of it from our pages/files?

my actual aqi page is here:

http://www.gateway2capecod.com/wxaqirss.php


...chris



Hi Chris,

Yes, it appears that airnow has not released the 2nd Day forecast for half of the country.  Most of the time, all of the updates are done roughly around midnight.  At this time they will change the forecast to reflect the next two days.  I have seen this before and they usually have the problems resolved quickly.  Also, they are undergoing to changes to their structure too.  I'm thinking that I should add "N/A" if no forecast is found for day two?

Date: N/A
Type: N/A
Index: N/A
AQI Value:  N/A

Michael

Offline gateway2capecod

  • Posts: 1,813
  • Middleborough, Ma. USA
    • Middleborough, Ma. Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #13 on: July 12, 2010, 02:50:36 PM »
Hi michael....

Probabbly not a bad idea to add the "N/A"...Just incase this happens in future. Maybe once they get the restruct completed, they will have 2 days forecast data on a regular basis.

I also think when you release a new update to the download file package, you should remove this line of code:

<img src="Relay_logo_85.png" align="right" border="0" width="55" height="55" alt="" />


..from the "wxaqirss.php" file, so that it doesnt look for your relay logo and confuse anyone new to setting this page up.


overall a nice new script and I will use this one from now on, in place of the old AQI Script I was using.

Good Job!....Chris

Offline FLWeather

  • Posts: 164
  • Jupiter, FL
    • Live Jupiter, FL Weather
Re: NEW Air Quality Script for Carterlake Template (RSS Version)
« Reply #14 on: July 12, 2010, 05:32:01 PM »
Thank you, Michael! Works great! :)

 

cumulus