WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: Curly on July 30, 2012, 07:58:04 AM

Title: New Weather Alert Program
Post by: Curly on July 30, 2012, 07:58:04 AM
A new weather alert program is available to get alerts for a specified county by using a Zone code and a County code.
Data is provided by the National Weather Service - Public Alerts which they update every two minutes.

KEY FEATURES


This program, NWS-alerts, is designed to fit into most web sites in the US and Puerto Rico using PHP version 5 or newer.
The complete package comes with detailed instructions in a read-me file, web pages for the summary and details, files, and icons.

If you are using the Saratoga Base-USA V3 template, you can update your files and get this program by using the PHP/AJAX Website Template Set - Updates (http://saratoga-weather.org/wxtemplates/updates.php) page at Saratoga.org.
Or you can download the package at http://www.weather.ricksturf.com/scripts/nws-alerts.zip (http://www.weather.ricksturf.com/scripts/nws-alerts.zip)


Note: This is a replacement for the AtomFeed program. The main file is half the size, it's easier to configure locations, a few more options added, and downloads data faster. Sorry, but this new program does not have the ability to log alerts like the AtomFeed.
Title: Re: New Weather Alert Program
Post by: Axelvold on July 30, 2012, 08:08:56 AM
The download link does not work.

http://www.weather.ricksturf.com/scripts/nwsalerts.zip (http://www.weather.ricksturf.com/scripts/nwsalerts.zip) just returns a 404 error.
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 08:12:33 AM
Sorry about that    #-o
I forgot to put the dash in the file name.
It works now.
http://www.weather.ricksturf.com/scripts/nws-alerts.zip (http://www.weather.ricksturf.com/scripts/nws-alerts.zip)
Title: Re: New Weather Alert Program
Post by: Axelvold on July 30, 2012, 08:14:07 AM
Sorry about that    #-o
It works now.

Jepp, it does.  =D>

Thank's Curly
Title: Re: New Weather Alert Program
Post by: AWL on July 30, 2012, 08:34:38 AM
I have been running your old one for a long time now with no problems. Should I update or stay with your old one?

Thanks for the great scripts, Doug
Title: Re: New Weather Alert Program
Post by: ed2kayak on July 30, 2012, 08:57:00 AM
Up and running here.

http://cvweather.org/index.php

Kudos to Curly. =D>
Thank you to Ken, as well,  for integrating in template set.
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 09:28:46 AM
I have been running your old one for a long time now with no problems. Should I update or stay with your old one?

"If it's not broke...."

The NWS-alerts is a smaller program and faster getting alerts for multiple locations.
If you have more than two locations in the AtomFeed and not using the Saratoga Base-USA V3 template kit, then you can keep what you have.
I do recommend the update if you are using Kens Base-USA V3 template kit, planning to update from version 2, or have one (or possibly two) alert locations.
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 10:21:49 AM
Up and running here.

http://cvweather.org/index.php

Thanks Ed for beta testing this program and your input.

Also, thanks go out to others testing the script - Jerry (http://gwwilkins.org/index.php), Jim (http://somdweather.com/), Ken (http://saratoga-weather.org/index.php), and Frank (http://np3od.freehostingcloud.com/cumulus/).
Title: Re: New Weather Alert Program
Post by: Andy G on July 30, 2012, 12:02:59 PM
Running Here http://www.sunprairieweather.com/ (http://www.sunprairieweather.com/)

Thanks Curly and everyone else

I have two questions

1. can I add this to any page by following the procedure for the index page?

2. If i want to add more counties how would I set up the cron job I have done it before for other things  but am unsure what to "cron" maybe i missed it in the instructions.

Thanks again Andy
Title: Re: New Weather Alert Program
Post by: gwwilk on July 30, 2012, 12:23:24 PM
Running Here http://www.sunprairieweather.com/ (http://www.sunprairieweather.com/)

Thanks Curly and everyone else

I have two questions

1. can i add this to any page by following the procedure for the index page?

2. If i want to add more counties how would I set up the cron job I have done it before for other things  but am unsure what to "cron" maybe i missed it in the instructions.

Thanks again Andy

Curly's offline, but I can answer #2 above.  Windows System Scheduler, available free here (http://www.splinterware.com/products/wincron.htm), is the program you probably want.  I use it for a number of scheduling/CRON jobs on my site, including WXSIM.

I think you can add it to any page on your website, but I haven't done so.  Curly would be able to provide a definitive answer to that question.


Title: Re: New Weather Alert Program
Post by: CNYWeather on July 30, 2012, 12:41:29 PM
Looks like another project. Thanks to Curly and all the guys who tested it out.

Stupid Question probably, any way to get this to Tweet the alerts too like NWS-Alert-Messenger does?
That would be a huge addition but probably a lot of effort.
Title: Re: New Weather Alert Program
Post by: saratogaWX on July 30, 2012, 12:41:54 PM
Thanks to Curly for graciously allowing the new NWS-alerts system to be included in the Base-USA V3 template set!

For those using the updates tool page (http://saratoga-weather.org/wxtemplates/updates.php) to get the new files,
use 28-Jul-2012 as the date for the Base-USA query .. that way, you'll get a complete set.

There is a README-Base-USA-changes-2012-07-28.txt file included that shows the additions to Settings.php, header.php, menubar.php needed if you choose to modify your existing files instead of porting your current mods to the new files.  It also includes a bit about setting up cron.   Curly's documentation is in the NWS-alerts_read_me.html file.

Best regards,
Ken
Title: Re: New Weather Alert Program
Post by: Andy G on July 30, 2012, 12:55:22 PM
Thanks for the info Ken I found the read me file will work on it.

Andy
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 01:08:31 PM
Stupid Question probably, any way to get this to Tweet the alerts too like NWS-Alert-Messenger does?
That would be a huge addition but probably a lot of effort.

Sorry Tony but I don't know what it would take to do that.
Title: Re: New Weather Alert Program
Post by: CNYWeather on July 30, 2012, 01:25:37 PM
No problem.  :-)
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 01:29:59 PM
Running Here http://www.sunprairieweather.com/ (http://www.sunprairieweather.com/)

Thanks Curly and everyone else

I have two questions

1. can I add this to any page by following the procedure for the index page?

Yes you can.

Quote
2. If i want to add more counties how would I set up the cron job I have done it before for other things  but am unsure what to "cron" maybe i missed it in the instructions.

In Kens update files, there are instructions on how to set up a real cron job.
I personally use the Windows Task Scheduler. A link is provided on how to use the Task Scheduler in the NWS-alerts_read_me file.
Either way you choose to do it, it has to call the nws-alerts.php file every xx amount of minutes to update the cache files.




Title: Re: New Weather Alert Program
Post by: Andy G on July 30, 2012, 01:59:04 PM
Sorry to ask such a basic question from you experts

If I use windows Task Scheduler will this work on my godaddy linux server or does it stay locally on my computer and "do its thing".

or if I have a linux server I must use a cron job?

Thanks Andy
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 02:11:33 PM
If I use windows Task Scheduler will this work on my godaddy linux server or does it stay locally on my computer and "do its thing".

or if I have a linux server I must use a cron job?

All of the NWS-alerts files are kept on the GoDaddy server and none are used on your computer.
If you want Windows Task Scheduler to call the new-alerts.php file, a small .vbs file is used on your computer.

I'm not familiar with GoDaddys Cpanel but it should be able to run a cron. GoDaddy should have documentation about setting up a cron job.
Title: Re: New Weather Alert Program
Post by: gwwilk on July 30, 2012, 02:14:19 PM
I use GoDaddy, and I had already long since exceeded their meager CRON job allotment, so I went with Windows System Scheduler.  It's easy to configure and use once you get the hang of it.
Title: Re: New Weather Alert Program
Post by: Andy G on July 30, 2012, 03:09:18 PM
I must have set the godaddy cron job up correctly. I added brown county (currently under a watch) to my array as a test and it works! I will work on the windows scheduler later I'm off to work now.

Thanks Curly and everyone else for your replies.

Andy
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 03:17:05 PM
It's working like it should!
Title: Re: New Weather Alert Program
Post by: saratogaWX on July 30, 2012, 03:18:14 PM
You won't need the windows scheduler if you have a working cron job .. no need to have the data fetched by two different methods.  Use the scheduler only if you have no cron jobs available.
Title: Re: New Weather Alert Program
Post by: n3ouc on July 30, 2012, 03:24:51 PM
Hi Curly,
Thank you for this update and to Ken for the ease of incorporating it into the V3 templates. All is up and running on both sites and looking good!

Thanks Again,
Mike
Title: Re: New Weather Alert Program
Post by: user3162 on July 30, 2012, 03:48:41 PM
Script is very nice, thanks Curly! My question, I don't get much traffic, ~15 unique visitors a day. Would I not be better off to not use a cron or scheduler?
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 04:34:52 PM
Script is very nice, thanks Curly! My question, I don't get much traffic, ~15 unique visitors a day. Would I not be better off to not use a cron or scheduler?

Glad you like it!

Setting up a cron job just speeds things up depending on the total codes you have in the array.
Each location should have at least 2 codes to check for alerts. If you have four locations, that would be a minimum of 8 codes.
Each code entered takes about 2 tenths of a second to check for alerts. If an alert is found, then the alert(s) are downloaded for that code and that takes about 2 tenths of a second per code.
Four tenths of a second doesn't seem that long for each code but that's when conditions are right. When conditions are not right, it could take two to four seconds per code just to check for alerts and then that amount for downloading the alert details. NOW the check and download times are starting to add up per code.

Without a cron, the index page visit makes the script download the data. For one location when conditions are not favorable, the index page wouldn't load for 8 seconds, but that is tolerable.
If you had 4 locations, that could be well over 30 seconds to wait for the page to load. I think that would discourage any visitor.

The purpose of a cron is to have the cache files already on hand so that the index page won't stall out waiting on the downloads if the internet conditions are bad.

In my opinion, if the total amount of codes in the array is four or less, then I would not use a cron. Anything over four should use a cron.



Title: Re: New Weather Alert Program
Post by: CNYWeather on July 30, 2012, 08:25:40 PM
Just 1 thing Curly. Trying to center the text "No Watches, Warnings or Advisories in Effect for Central New York"
within the alert box. I'm striking out so far. Changed some of the wording like I had in the SWSP Alert Program.

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

Code: [Select]
// alert box conditions for NO alerts
  if($useAlertBox and empty($atData)) {                                                      // IF using alert box and no alerts
    get_scc('150');                                                                          //   set alert box backgound color and text color
    $box .= "\n<!-- nws-alerts box -->\n"
         .'<div style="width:'.$aBox_Width
         .'; border:solid thin #000; margin:0px auto 0px auto;">'."\n";
    if($showNone) {                                                                          //   IF showing "NONE', create alert box with No Alert
      $box .= ' <div style=" '.$bc.' '.$ct.' '.$tc.' '.'padding:4px 8px 4px 8px"><a href="'
           .$summaryURL.'" title=" &nbsp;View current watches or warnings" style="text-decoration:none; text-align: center; '.$tc
           .'">No Watches, Warnings or Advisories in Effect for Central New York</a></div>
</div>

text-align: center in the wrong spot?

THANKS!!
 :grin:
Title: Re: New Weather Alert Program
Post by: Curly on July 30, 2012, 09:04:57 PM
To center the text in the alert box, open nws-alerts-config.php
Change  $centerText  from false to true

$centerText switches $ct to left align when false or center when true.

If you want to permanently have that the text centered for the no alerts condition, find this line:
Code: [Select]
$box .= ' <div style=" '.$bc.' '.$ct.' '.$tc.' '.'padding:4px 8px 4px 8px"><a href="'
Change it to this:
Code: [Select]
$box .= ' <div style=" '.$bc.' '.$tc.' padding:4px 8px 4px 8px; text-align: center"><a href="'
And then remove the  text-align: center;  where you inserted it after  decoration:none;
Title: Re: New Weather Alert Program
Post by: CNYWeather on July 31, 2012, 09:35:32 AM
Perfect. Thanks Curly.

There will be no HWO or Short Term with this setup, right?
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2012, 09:58:46 AM
There will be no HWO or Short Term with this setup, right?

Right.
The NWS does not include those in the CAP/ATOM feeds.
Title: Re: New Weather Alert Program
Post by: jay_hoehn on July 31, 2012, 08:49:06 PM
Curly,

Great work on the script.  Love the Google Maps.

Jay
Title: Re: New Weather Alert Program
Post by: jahuff on July 31, 2012, 10:34:39 PM
Hi Curly,

I have the cron job set up but it's not working correctly.

I might not have the permissions correct on the files.

Code: [Select]
PHP Warning:  fopen(./cache/nws-alertsMainData.php): failed to open stream: No such file or directory in /home/johnsnh/public_html/nws-alerts.php on line 263 PHP Warning:  fopen(./cache/nws-alertsBoxData.php): failed to open stream: No such file or directory in /home/johnsnh/public_html/nws-alerts.php on line 425 PHP Warning:  fopen(./cache/nws-alertsIconData.php): failed to open stream: No such file or directory in /home/johnsnh/public_html/nws-alerts.php on line 514 PHP Warning:  fopen(nws-rssfeed.xml): failed to open stream: Permission denied in /home/johnsnh/public_html/nws-alerts.php on line 581
<!-- nws-alerts.php - 1.13 - 29-July-2012 - NWS Public Alerts -->
<!-- Cron job enabled -->
<!-- Preliminary codes checked: 4 -->
<!-- Preliminary data cull: 0.8956 seconds -->
<!-- Average cull per code: 0.2239 seconds -->
<!-- Primary alerts downloaded: 0 -->
<!-- Primary data cull: 0.0000 seconds -->
<!-- unable to open cache file -->
<!-- unable to open cache file -->
<!-- unable to open big icon cache file -->
<!-- unable to open rss feed cache file -->
<!-- Total script process time: 0.8962 seconds --> PHP Warning:  fopen(./cache/nws-notes.txt): failed to open stream: No such file or directory in /home/johnsnh/public_html/nws-alerts.php on line 931 PHP Warning:  fputs(): supplied argument is not a valid stream resource in /home/johnsnh/public_html/nws-alerts.php on line 932 PHP Warning:  fclose(): supplied argument is not a valid stream resource in /home/johnsnh/public_html/nws-alerts.php on line 933


Obviously I'm not good with cron jobs.

Thanks,

John
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2012, 10:51:46 PM
Quote
I have the cron job set up but it's not working correctly.

I can manually call the file without errors and all of the files update.
Did you set up a cron job in cpanel?

EDIT - There hasn't been an update in 30 minutes. What time span is the cron?
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2012, 10:56:05 PM
Quote
Great work on the script.  Love the Google Maps.

Thanks!
Ah, you have an alert with a shape file.
It can get quite colorful when there are more alerts.
Title: Re: New Weather Alert Program
Post by: jahuff on August 01, 2012, 07:26:34 AM
Hi Curly,

The cron job was setup in cpanel and runs every 5 minutes.

I just checked and it's running.

Thanks for getting back to me.

John

I just ran it manually also and it did run so  the problem must be with the cron job.
Title: Re: New Weather Alert Program
Post by: jahuff on August 01, 2012, 07:21:20 PM
Hi Curly,

I might be making some progress -- I think  :shock: -- when my cron job run I get this in the cron job email.

Code: [Select]
PHP Warning:  fopen(nws-rssfeed.xml): failed to open stream: Permission denied in /home/johnsnh/public_html/nws-alerts.php on line 581
<!-- nws-alerts.php - 1.13 - 29-July-2012 - NWS Public Alerts -->
<!-- Cron job enabled -->

<!-- cURL error: Operation timed out after 2000 milliseconds with 0 bytes received -->
<!-- http://alerts.weather.gov/cap/wwaatmget.php?x=CAC085  -->
<!-- First attempt in getting preliminary URL failed -->
<!-- Second attempt successful -->
<!-- http://alerts.weather.gov/cap/wwaatmget.php?x=CAC085 -->


<!-- cURL error: Operation timed out after 2000 milliseconds with 0 bytes received -->
<!-- http://alerts.weather.gov/cap/wwaatmget.php?x=CAZ529  -->
<!-- First attempt in getting preliminary URL failed -->
<!-- Second attempt successful -->
<!-- http://alerts.weather.gov/cap/wwaatmget.php?x=CAZ529 -->

<!-- Preliminary codes checked: 4 -->
<!-- Preliminary data cull: 4.5999 seconds -->
<!-- Average cull per code: 1.15 seconds -->
<!-- Primary alerts downloaded: 0 -->
<!-- Primary data cull: 0.0000 seconds -->
<!-- Cache file updated: Wed 4:15 pm -->
<!-- Alert box data file updated -->
<!-- Icon data file updated -->
<!-- unable to open rss feed cache file -->
<!-- Total script process time: 4.6006 seconds -->

To get this far i removed the trailing / from $cacheFileDir  = './cache';                // default cache file directory

Look like I have a permission problem???

Thanks,

John
Title: Re: New Weather Alert Program
Post by: Curly on August 01, 2012, 07:43:22 PM
Quote
PHP Warning:  fopen(nws-rssfeed.xml): failed to open stream: Permission denied in /home/johnsnh/public_html/nws-alerts.php on line 581
nws-alerts.php is denied permission to open the file and write the data.
You will have to set the permission level higher. I would set the permission level to at least 664 on nws-rssfeed.xml and also on nws-alerts.php.

Quote
<!-- cURL error: Operation timed out after 2000 milliseconds with 0 bytes received -->
<!-- http://alerts.weather.gov/cap/wwaatmget.php?x=CAC085  -->
<!-- First attempt in getting preliminary URL failed -->
<!-- Second attempt successful -->
<!-- http://alerts.weather.gov/cap/wwaatmget.php?x=CAC085 -->
This is expected.
With all of the downloading, there's a point in time when that particular file is getting updated by the NWS and the script wants it at that time. If the first attempt fails the download for a code, it will wait a half second and then will try a second time to download it again.
Title: Re: New Weather Alert Program
Post by: Curly on August 01, 2012, 07:49:57 PM
Quote
To get this far i removed the trailing / from $cacheFileDir  = './cache'; 
If you removed it from the nws-alerts-config.php file, it wouldn't have any affect. The Settings.php file has this setting in there and that overrides what is in the config file.
Title: Re: New Weather Alert Program
Post by: jahuff on August 01, 2012, 09:39:52 PM
Hi,

I set the permission level to 664 on nws-rssfeed.xml and 774 on nws-alerts.php. I still get

Code: [Select]
PHP Warning:  fopen(nws-rssfeed.xml): failed to open stream: Permission denied in /home/johnsnh/public_html/nws-alerts.php on line 581
<!-- nws-alerts.php - 1.13 - 29-July-2012 - NWS Public Alerts -->
<!-- Cron job enabled -->
<!-- Preliminary codes checked: 48 -->
<!-- Preliminary data cull: 6.4546 seconds -->
<!-- Average cull per code: 0.1345 seconds -->
<!-- Primary alerts downloaded: 0 -->
<!-- Primary data cull: 0.0000 seconds -->
<!-- Cache file updated: Wed 6:25 pm -->
<!-- Alert box data file updated -->
<!-- Icon data file updated -->
<!-- unable to open rss feed cache file -->
<!-- Total script process time: 6.4559 seconds -->

Is the cron job running to completion?  :oops: This is my first time using this type of job.

The time stamp on the server files is not updating, do they only update if the file changes?

Now when I try and run nws-alerts.php manually I get a 404 message, not sure what that is all about.

I appreciate all of your help.

Thanks,

John
Title: Re: New Weather Alert Program
Post by: Curly on August 01, 2012, 09:44:10 PM
Hi,

I set the permission level to 664 on nws-rssfeed.xml and 774 on nws-alerts.php. I still get

Code: [Select]
PHP Warning:  fopen(nws-rssfeed.xml): failed to open stream: Permission denied in /home/johnsnh/public_html/nws-alerts.php on line 581
<!-- nws-alerts.php - 1.13 - 29-July-2012 - NWS Public Alerts -->
<!-- Cron job enabled -->
<!-- Preliminary codes checked: 48 -->
<!-- Preliminary data cull: 6.4546 seconds -->
<!-- Average cull per code: 0.1345 seconds -->
<!-- Primary alerts downloaded: 0 -->
<!-- Primary data cull: 0.0000 seconds -->
<!-- Cache file updated: Wed 6:25 pm -->
<!-- Alert box data file updated -->
<!-- Icon data file updated -->
<!-- unable to open rss feed cache file -->
<!-- Total script process time: 6.4559 seconds -->

Is the cron job running to completion?  :oops: This is my first time using this type of job.

The time stamp on the server files is not updating, do they only update if the file changes?

Now when I try and run nws-alerts.php manually I get a 404 message, not sure what that is all about.

I appreciate all of your help.

Thanks,

John

I went to manually run nws-alerts.php and got a 404.
And also the config file isn't there.
Title: Re: New Weather Alert Program
Post by: jahuff on August 01, 2012, 10:03:14 PM
Hi Curly,

The config file is in /public_html/, something has gone ape $%#@. nws-alerts.php is also in that directory.

Not sure what is going on.

John
Title: Re: New Weather Alert Program
Post by: jahuff on August 01, 2012, 10:15:18 PM
Hi, I think I need to walk away and start fresh tomorrow.
Thanks for all your help.
John
Title: Re: New Weather Alert Program
Post by: jahuff on August 03, 2012, 08:31:27 AM
Hi Curly,

Thanks so much for your support, the problem was the cron job.

Everything is working perfectly, can be seen at www.johnsnhweather.com

John
Title: Re: New Weather Alert Program
Post by: Curly on August 03, 2012, 09:29:05 AM
Sorry to see that you had a struggle setting up the cron job.

Happy to hear that your persistence did get it working!
Title: Re: New Weather Alert Program
Post by: DaculaWeather on August 03, 2012, 09:43:48 AM
Crap... yes the Google map is nice. I HATE changing things... what a PITA.

Nice script as usually Curly, not sure how much customizing I'm going to have to do.
Title: Re: New Weather Alert Program
Post by: Curly on August 03, 2012, 10:13:47 AM
Crap... yes the Google map is nice. I HATE changing things... what a PITA.
The AtomFeed program was inefficient and I thought that needed a major change.
With 200 hours in developing a new program, I considered it to be a challenge instead of a PITA to make an improvement.

Quote
Nice script as usually Curly, not sure how much customizing I'm going to have to do.
Thanks!
I try to code pages so that everything is grouped together so customizing is a little easier.
Title: Re: New Weather Alert Program
Post by: DaculaWeather on August 03, 2012, 10:16:24 AM
Thanks Curly! I wasn't giving you a hard time, I know it took way more work for you than it will for me! And yes, it is ALWAYS a challenge to go modify someone else's code to work on my pages!  :grin:
Title: Re: New Weather Alert Program
Post by: Curly on August 03, 2012, 10:44:30 AM
Thanks Curly! I wasn't giving you a hard time, I know it took way more work for you than it will for me! And yes, it is ALWAYS a challenge to go modify someone else's code to work on my pages!  :grin:

I didn't take it that you were giving me a hard time Steve...  Just expressing that a PITA can be also be thought as a rewarding challenge.

I am guilty of changing code. My web site is a Saratoga Base-USA template but doesn't look like one.
Title: Re: New Weather Alert Program
Post by: jahuff on August 05, 2012, 07:08:41 AM
Hi Curly,

I am having a formatting issue. I have this setting -- $aBox_Width    = '692px'; --. I have attached a screenshot. What can I change to correct this.

The formatting problem only shows up in Firefox, IE works fine.

Thanks,

John
Title: Re: New Weather Alert Program
Post by: Curly on August 05, 2012, 08:13:18 AM
I've updated the nws-alerts.php to fix that spacing issue in the alert box.

You can download just the needed file here  http://www.weather.ricksturf.com/scripts/nws-alertsFILE.zip (http://www.weather.ricksturf.com/scripts/nws-alertsFILE.zip)
After downloading, extract the file and upload it. The changes won't take affect until the next update.
You can manually update it by running    nws-alerts.php?mu=1
Title: Re: New Weather Alert Program
Post by: jahuff on August 05, 2012, 06:48:50 PM
Quote
I've updated the nws-alerts.php to fix that spacing issue in the alert box.

Thanks Curly,

I have downloaded and installed the new program. All is well at johnsnhweather.com.

Thanks,

John
Title: Re: New Weather Alert Program
Post by: mth on August 07, 2012, 09:32:27 AM
Curly,

Many thanks for such a brilliant script.  Your continued sharing and support never goes unnoticed.  =D&gt;

Michael
Title: Re: New Weather Alert Program
Post by: stormwatch on August 09, 2012, 07:56:20 PM
Thanks once again for a wonderful script!!! Glad to see you back providing this great work...hope you are feeling better! =D&gt;
Title: Re: New Weather Alert Program
Post by: Gordon on August 10, 2012, 09:45:37 AM
No surprises here...expected nothing but brilliance from Curly...

Thank you Sir!
Title: Re: New Weather Alert Program
Post by: Bunty on August 18, 2012, 04:46:35 PM
I had my first run with the program this morning.  I liked it, except when the alert page is finished loading, you have to scroll up to see the google map.  I'd rather the page open with google map visible to the viewer without scrolling.
Title: Re: New Weather Alert Program
Post by: Curly on August 18, 2012, 06:10:16 PM
Quote
I'd rather the page open with google map visible to the viewer without scrolling.

Open nws-alerts-details-inc.php
Find and delete this line:
Code: [Select]
<a name="WA'.$aav[13].'" id="WA'.$aav[13].'"></a>
Save the file and upload it.
Title: Re: New Weather Alert Program
Post by: jgillett on August 22, 2012, 11:13:18 AM
Quote
I'd rather the page open with google map visible to the viewer without scrolling.

Open nws-alerts-details-inc.php
Find and delete this line:
Code: [Select]
<a name="WA'.$aav[13].'" id="WA'.$aav[13].'"></a>
Save the file and upload it.

I like that better, too.

Thanks, Curly!
Title: Re: New Weather Alert Program
Post by: jahuff on September 05, 2012, 12:10:05 AM
Hi Curly,

Where do I permanently change the text in the advisory box on the index page from "No alerts" to "No Watches, Warnings or Advisories in Effect for Eastern Vermont, New Hampshire and Western Maine.". I had this working once but after an update I can't seem to find the location to change.  The index page can be seen at http://www.johnsnhweather.com/

Thanks for your help.

John
Title: Re: New Weather Alert Program
Post by: Curly on September 05, 2012, 12:36:21 AM
Quote
Where do I permanently change the text in the advisory box on the index page from "No alerts" to

That would be in the file nws-alerts.php
Find this line:
Code: [Select]
.'">No alerts</a></div>
Replace it with this:
Code: [Select]
.'">No Watches, Warnings or Advisories in Effect for Eastern Vermont, New Hampshire and Western Maine.</a></div>
Title: Re: New Weather Alert Program
Post by: jahuff on September 05, 2012, 08:10:56 AM
Thanks Curly, I have made the change, when the current SPECIAL WEATHER STATEMENT ends I should see my "No alert" message. John
Title: Re: New Weather Alert Program
Post by: n7xrd on September 09, 2012, 12:09:30 PM
Anyone have any idea why my IP on my server shows up on the who's online for hours at a time searching nws-alerts.php ?
Title: Re: New Weather Alert Program
Post by: Curly on September 09, 2012, 12:40:29 PM
Anyone have any idea why my IP on my server shows up on the who's online for hours at a time searching nws-alerts.php ?

I have no idea on this. The program is running like it should.
Are you using a cron job to run the program?
Title: Re: New Weather Alert Program
Post by: n7xrd on September 09, 2012, 12:46:52 PM
Anyone have any idea why my IP on my server shows up on the who's online for hours at a time searching nws-alerts.php ?

I have no idea on this. The program is running like it should.
Are you using a cron job to run the program?
Hi Curly thanks for the program!!!   As far as I can tell the program is working correctly just not sure why it stays connected I have Windows Scheduler set to every 10 minutes update!
Title: Re: New Weather Alert Program
Post by: n7xrd on September 13, 2012, 01:10:50 PM
Anyone have any idea why my IP on my server shows up on the who's online for hours at a time searching nws-alerts.php ?

I have no idea on this. The program is running like it should.
Are you using a cron job to run the program?
  Curly I noticed if I turn the Task Scheduler off my Guest goes offline...When I turn it back on to run the nws-alerts.php my Guest reappears and stays connected up to 80 hours one time so far..the Guest is MY servers IP  ?
Title: Re: New Weather Alert Program
Post by: Curly on September 13, 2012, 05:54:47 PM
Quote
I noticed if I turn the Task Scheduler off my Guest goes offline...When I turn it back on to run the nws-alerts.php my Guest reappears and stays connected up to 80 hours one time so far..the Guest is MY servers IP  ?

What time interval (in minutes) is set in the task scheduler to run the nws-alerts.php file?
What program is giving you the 80 hours?
Title: Re: New Weather Alert Program
Post by: n7xrd on September 13, 2012, 05:59:33 PM
Quote
I noticed if I turn the Task Scheduler off my Guest goes offline...When I turn it back on to run the nws-alerts.php my Guest reappears and stays connected up to 80 hours one time so far..the Guest is MY servers IP  ?

What time interval (in minutes) is set in the task scheduler to run the nws-alerts.php file?
What program is giving you the 80 hours?
10 minute interval and who's online was showing this...right now it's showing over 5 hours as I have been turning the interval on and off for testing today!
Title: Re: New Weather Alert Program
Post by: Curly on September 13, 2012, 06:43:53 PM
10 minute interval and who's online was showing this...

Manually running the program is working properly and it takes about 8 seconds run.
So the information, 80 hours, is the next possible source to look over.
How many days did it take to log the 80 hours ?   20 days?

Who's online has this:
Quote
2    Visitor(s) online (Considered inactive after 5 minutes. Removed after 15 minutes)

This is my theory since I don't use who's online.
I believe who's online is recognizing the nws-alerts.php file being ran every ten minutes and is continually cycling active and inactive for 24 hours a day.
Title: Re: New Weather Alert Program
Post by: n7xrd on September 13, 2012, 07:34:05 PM
10 minute interval and who's online was showing this...

Manually running the program is working properly and it takes about 8 seconds run.
So the information, 80 hours, is the next possible source to look over.
How many days did it take to log the 80 hours ?   20 days?

Who's online has this:
Quote
2    Visitor(s) online (Considered inactive after 5 minutes. Removed after 15 minutes)

This is my theory since I don't use who's online.
I believe who's online is recognizing the nws-alerts.php file being ran every ten minutes and is continually cycling active and inactive for 24 hours a day.
Thanks Curly I think I will increase the time between intervals and see what happens....maybe evey 30 minutes...
Title: Re: New Weather Alert Program
Post by: gwwilk on September 22, 2012, 09:46:07 AM
I just encountered a problem with nws-alerts, Curly.  We have a freeze warning issued locally, but it isn't showing up in my alerts.  Have I misconfigured something?

Atom Alerts (http://www.gwwilkins.org/AtomAlerts.php) displays it while nws-alerts (http://www.gwwilkins.org/wxadvisory.php) doesn't.  (Don't click the links unless you have a fast broadband connection!)
Title: Re: New Weather Alert Program
Post by: DaculaWeather on September 22, 2012, 09:50:58 AM
Makes sure that both zone and county codes are correct.
Title: Re: New Weather Alert Program
Post by: Curly on September 22, 2012, 10:03:48 AM
I just encountered a problem with nws-alerts, Curly.  We have a freeze warning issued locally, but it isn't showing up in my alerts.  Have I misconfigured something?

Atom Alerts (http://www.gwwilkins.org/AtomAlerts.php) displays it while nws-alerts (http://www.gwwilkins.org/wxadvisory.php) doesn't.  (Don't click the links unless you have a fast broadband connection!)

The file nws-alerts.php wasn't updating.
After I manually ran the file, the Freeze Warnings showed up.
How is the nws-alerts.php file called and at what intervals? Cron? Task Scheduler? Every 10 minutes?
Title: Re: New Weather Alert Program
Post by: gwwilk on September 22, 2012, 11:14:56 AM
Thanks, Curly!

I had a CRON job set up under System Scheduler, but somehow while I was fiddling around recently with WD and other CRON jobs on that computer the CRON job got hosed because while the minutes to run (every 10) were still there, the hours to run (every hour) had gone missing.  #-o All fixed now, and thanks again! :-)
Title: Re: New Weather Alert Program
Post by: n7xrd on October 02, 2012, 10:48:20 PM
Is there a way to limit which alerts show in the top box om the site and still have all the warnings on the menu?
Title: Re: New Weather Alert Program
Post by: Curly on October 03, 2012, 06:02:37 AM
Is there a way to limit which alerts show in the top box om the site and still have all the warnings on the menu?

The alert box shows all.
Removing duplicate events is the only option to limit the amount of alerts.
Title: Re: New Weather Alert Program
Post by: n7xrd on October 03, 2012, 08:31:17 AM
Thanks Curly wasn't sure before you could just show your main county!! 
Title: Re: New Weather Alert Program
Post by: Stetson1 on October 28, 2012, 05:09:38 PM
I must be stupid because I cannot get the errors at the top of my site to clear. This is what I am getting, not sure if it is permissions or I have screwed up the config. Any help is appreciated.

Todd


Warning: fopen(./cache/nws-alertsMainData.php) [function.fopen]: failed to open stream: Permission denied in /virtual/users/e16607-17912/web/nws-alerts.php on line 264

Warning: fopen(./cache/nws-alertsBoxData.php) [function.fopen]: failed to open stream: Permission denied in /virtual/users/e16607-17912/web/nws-alerts.php on line 426

Warning: fopen(./cache/nws-alertsIconData.php) [function.fopen]: failed to open stream: Permission denied in /virtual/users/e16607-17912/web/nws-alerts.php on line 515

Warning: fopen(nws-rssfeed.xml) [function.fopen]: failed to open stream: Permission denied in /virtual/users/e16607-17912/web/nws-alerts.php on line 582

Warning: fopen(./cache/nws-notes.txt) [function.fopen]: failed to open stream: Permission denied in /virtual/users/e16607-17912/web/nws-alerts.php on line 932

Warning: fputs(): supplied argument is not a valid stream resource in /virtual/users/e16607-17912/web/nws-alerts.php on line 933

Warning: fclose(): supplied argument is not a valid stream resource in /virtual/users/e16607-17912/web/nws-alerts.php on line 934
Title: Re: New Weather Alert Program
Post by: Stetson1 on October 28, 2012, 05:17:22 PM
Well I am getting a little smarter. It was a permission issue, I had not given the right permissions. Problem solved. Love the new script Curly, excellent work.

Todd
Title: Re: New Weather Alert Program
Post by: SoMDWx on November 06, 2012, 09:17:05 AM
Curly,
  Is there a way to turn OFF the google maps witin the alert screens?

Jim
Title: Re: New Weather Alert Program
Post by: DaculaWeather on November 06, 2012, 09:24:06 AM
 :-) One reason I STILL use the older script!
Title: Re: New Weather Alert Program
Post by: Curly on November 06, 2012, 06:12:58 PM
Curly,
  Is there a way to turn OFF the google maps witin the alert screens?

Jim

Yes you can turn off the Google map.
This setting is a little different than a switch. In the location array in the file nws-alerts-config.php, the first code entered after location determines the map display.  A Zone code displays the map while a County code turns it off.
Default setting to display the map for each location:
Code: [Select]
$myZC = array(
  "St. Marys|MDZ017|MDC037",
  "Calvert|MDZ018|MDC009",
  "Charles|MDZ016|MDC017"
);

Array to turn off the map for each location:
Code: [Select]
$myZC = array(
  "St. Marys|MDC037|MDZ017",
  "Calvert|MDC009|MDZ018",
  "Charles|MDC017|MDZ016"
);

This allows you to be selective of which locations to show or hide the map.
For instance, if you want the map to display for Charles only, change the first code back to the Zone code.   Charles|MDZ016|MDC017

Title: Re: New Weather Alert Program
Post by: SoMDWx on November 06, 2012, 10:11:40 PM
Thanks!

A bigger issue is that it appears that the script with $noCRon = true and a 60 seconds cache refresh is NOT refreshing the data with the latest alerts/changes....

I have to force it with mu=1

Jim
Title: Re: New Weather Alert Program
Post by: Curly on November 07, 2012, 05:47:02 AM
I see your beta program IS working like it should.

If you have it installed elsewhere on your site, I'm guessing it would be:
In-adequate file permissions.
Improper page code for $noCron = true.
Title: Re: New Weather Alert Program
Post by: SoMDWx on November 07, 2012, 07:39:25 AM
Yes, it seems to be working now, but when I had a Freeze Warning the other day and then it went away, the alert window still had the FREEZE WARNING lert in it for quite some time. I had to force it to re-read the latest NWS page to update it.

What permissinos should that directory and files be set for?

Jim
Title: Re: New Weather Alert Program
Post by: Curly on November 07, 2012, 08:47:53 PM
Yes, it seems to be working now, but when I had a Freeze Warning the other day and then it went away, the alert window still had the FREEZE WARNING lert in it for quite some time. I had to force it to re-read the latest NWS page to update it.

What permissinos should that directory and files be set for?

Did you force it through the index page or right from the script?
Without seeing the files and the configuration and the code on the index page, I could only guess at what is happening.
A link to what you are using would be helpful.

Setting file permissions varies due to policies set by the web host. Generally 664 works for the files but I've seen places where they had to be bumped up. The folder permission level should be set the same as, or higher than, the highest file permission level. Avoid using 777.

You would definitely see some errors about file permissions if they weren't adequate.
The update time in the summary page reads the last modified time of the cache file and that indicates when the script last checked the alerts and was able to write the cache file. If that changes, everything is good.
Title: Re: New Weather Alert Program
Post by: cospringswx on December 04, 2012, 12:26:37 PM
I have 2 problems with this.

1. RSS feed won't open? I've changed permission to 664 and also on NWS-alerts

2. I can't get the alert box to display at top of page?

http://hayskansasweather.com/wxadvisory.php


Title: Re: New Weather Alert Program
Post by: Curly on December 04, 2012, 05:42:27 PM
I have 2 problems with this.

1. RSS feed won't open? I've changed permission to 664 and also on NWS-alerts

2. I can't get the alert box to display at top of page?

http://hayskansasweather.com/wxadvisory.php

1 - It opens and updates every ten minutes for me. Are you using Chrome?

2 - Add this code where you want the alert box to be displayed:
Code: [Select]
<?php
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>
Title: Re: New Weather Alert Program
Post by: cospringswx on December 04, 2012, 05:45:43 PM
using Firefox.

When I put that code in my page don't load.

Where does the code go? index.php?
Title: Re: New Weather Alert Program
Post by: Curly on December 04, 2012, 06:04:18 PM
I'm using firefox and the RSS shows up here  http://www.hayskansasweather.com/nws-rssfeed.xml (http://www.hayskansasweather.com/nws-rssfeed.xml)

The alert box code usually goes in the index page. Since you are using the Saratoga base template, the header.php file and the index.php file needs to be modified.
These steps are explained in the read me file titled  Saratoga Base-USA set up
Title: Re: New Weather Alert Program
Post by: cospringswx on December 04, 2012, 06:16:28 PM
I did that in both files and I don't get a box at all!
Title: Re: New Weather Alert Program
Post by: Curly on December 04, 2012, 06:48:30 PM
Open nws-alerts-config.php and change  $showNone  from  false to true.
Save the file and upload it.
Title: Re: New Weather Alert Program
Post by: cospringswx on December 04, 2012, 06:51:23 PM
Ok I got a box now. How to edit colors and text as I can see anything.
Title: Re: New Weather Alert Program
Post by: cospringswx on December 04, 2012, 07:07:01 PM
How do you make the text larger inside the alert box? Mine is tiny.
Title: Re: New Weather Alert Program
Post by: Curly on December 04, 2012, 07:16:04 PM
There are several unclosed tags above the code interfering with the colors.
Without any alerts, the alert box has black text with a gray background. Getting the page to validate will make the alert box display like it should.
Title: Re: New Weather Alert Program
Post by: cospringswx on December 04, 2012, 07:22:38 PM
There are several unclosed tags above the code interfering with the colors.
Without any alerts, the alert box has black text with a gray background. Getting the page to validate will make the alert box display like it should.

I was successful changing background color. Trying to make the text larger but can't get it.
Title: Re: New Weather Alert Program
Post by: jonnyj771 on January 25, 2013, 01:27:08 AM
I have gone to the New Weather Alert Program.
However, I can't seem to get the page to get the update from NWS. I know my numbers are correct and at this point, I am only using 2 counties. so currently I am not running a cron.
when I check the element, I am seeing it's not opening the cache. i am using the standard cache folder. I appear to have all fields entered properly, but not sure what is missing.  ](*,)
lightningweather.com/wxadvisory.php (http://lightningweather.com/wxadvisory.php)  lightningweather.com/nws-alerts.php (http://lightningweather.com/nws-alerts.php)
Title: Re: New Weather Alert Program
Post by: saratogaWX on January 25, 2013, 01:33:22 AM
I have gone to the New Weather Alert Program.
However, I can't seem to get the page to get the update from NWS. I know my numbers are correct and at this point, I am only using 2 counties. so currently I am not running a cron.
when I check the element, I am seeing it's not opening the cache. i am using the standard cache folder. I appear to have all fields entered properly, but not sure what is missing.  ](*,)
lightningweather.com/wxadvisory.php (http://lightningweather.com/wxadvisory.php)  lightningweather.com/nws-alerts.php (http://lightningweather.com/nws-alerts.php)
The issue is a couple of settings in your Settings.php file
Code: [Select]
$SITE['imagesDir'] = 'http://lightningweather.com/ajax-images/';  // directory for ajax-images with trailing slash
//
$SITE['cacheFileDir']   =  'http://lightningweather.com/cache';   // directory to use for scripts cache files .. use './' for doc.root.dir
which should be FILE not URL addresses like
Code: [Select]
$SITE['imagesDir'] = './ajax-images/';  // directory for ajax-images with trailing slash
//
$SITE['cacheFileDir']   =  './cache/';   // directory to use for scripts cache files .. use './' for doc.root.dir
Title: Re: New Weather Alert Program
Post by: jonnyj771 on January 25, 2013, 02:17:20 AM

The issue is a couple of settings in your Settings.php file
Code: [Select]
$SITE['imagesDir'] = 'http://lightningweather.com/ajax-images/';  // directory for ajax-images with trailing slash
//
$SITE['cacheFileDir']   =  'http://lightningweather.com/cache';   // directory to use for scripts cache files .. use './' for doc.root.dir
which should be FILE not URL addresses like
Code: [Select]
$SITE['imagesDir'] = './ajax-images/';  // directory for ajax-images with trailing slash
//
$SITE['cacheFileDir']   =  './cache/';   // directory to use for scripts cache files .. use './' for doc.root.dir
[/quote]

I have a blog section on there and it requires me to have that setting...I will change it and see what happens.
Update: Fixed it... not sure why we have to use the url for setting up the blog section, but taking it off seems to have fixed the problem. Thanks for the quick reply Ken.
Title: Re: New Weather Alert Program
Post by: saratogaWX on January 25, 2013, 11:29:34 AM
For the Blog, you can still use your old $SITE['imagesDir'] entry, but the $SITE['cacheFileDir'] must be a relative file address (not an URL) for the scripts to be able to use cache files.  So, you could have
Code: [Select]
$SITE['imagesDir'] = 'http://lightningweather.com/ajax-images/';  // directory for ajax-images with trailing slash
//
$SITE['cacheFileDir']   =  './cache/';   // directory to use for scripts cache files .. use './' for doc.root.dir
Title: Re: New Weather Alert Program
Post by: n7xrd on February 26, 2013, 07:25:16 PM
anyone know why I get this error I don't get it all the time...Warning: fopen(nws-rssfeed.xml) [function.fopen]: failed to open stream: Permission denied in /virtual/users/e17485-19409/web/nws-alerts.php on line 582??
Title: Re: New Weather Alert Program
Post by: Curly on February 26, 2013, 07:57:52 PM
Do you get the error when  $useXML   is set to true?

The nws-rssfeed.xml file hasn't updated and that may have to do with the file permission level (chmod) is set too low.
I believe setting it to 664 will update the file and stop the error.
Title: Re: New Weather Alert Program
Post by: n7xrd on February 26, 2013, 08:13:15 PM
Do you get the error when  $useXML   is set to true?  This is set true already

The nws-rssfeed.xml file hasn't updated and that may have to do with the file permission level (chmod) is set too low.
I believe setting it to 664 will update the file and stop the error.  I will check the permission level I currently have the system stopped from updating..
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 01:44:02 AM
There are several unclosed tags above the code interfering with the colors.
Without any alerts, the alert box has black text with a gray background. Getting the page to validate will make the alert box display like it should.

What file should I edit to change colors and size of font on alert box?
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 02:55:30 AM
Quote
Where do I permanently change the text in the advisory box on the index page from "No alerts" to

That would be in the file nws-alerts.php
Find this line:
Code: [Select]
.'">No alerts</a></div>
Replace it with this:
Code: [Select]
.'">No Watches, Warnings or Advisories in Effect for Eastern Vermont, New Hampshire and Western Maine.</a></div>

What line is this on?
Title: Re: New Weather Alert Program
Post by: DaculaWeather on April 01, 2013, 05:50:22 AM
What do you use to do your coding? Can't you do a "find" or a search and replace?
Title: Re: New Weather Alert Program
Post by: DaculaWeather on April 01, 2013, 05:58:22 AM
Rick, how do you think the Impact Based Warning changes will make, if any, to your alert program?
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 01:01:36 PM
 
What do you use to do your coding? Can't you do a "find" or a search and replace?

Wow. Thanks for the help. :roll:
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 01:46:27 PM
Does anyone know how to make the text larger in the alert box? Someone has got to know.
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 05:57:00 PM
bump
Title: Re: New Weather Alert Program
Post by: Maumelle Weather on April 01, 2013, 07:36:06 PM
Hi Ryan,

Check your .css file for watchBox, warningBox, etc.

John
Title: Re: New Weather Alert Program
Post by: Curly on April 01, 2013, 07:38:44 PM
Does anyone know how to make the text larger in the alert box? Someone has got to know.

The easiest way is to change it on your index page.
Somewhere on the index page is this line:
Code: [Select]
echo $alertBox;
Replace that line with this:
Code: [Select]
echo '<div style="font-size:110%">'.$alertBox.'</div>';
Change the 110% to the size that you want.
Or you could replace the 110% with 14px.
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 08:35:33 PM
Does anyone know how to make the text larger in the alert box? Someone has got to know.

The easiest way is to change it on your index page.
Somewhere on the index page is this line:
Code: [Select]
echo $alertBox;
Replace that line with this:
Code: [Select]
echo '<div style="font-size:110%">'.$alertBox.'</div>';
Change the 110% to the size that you want.
Or you could replace the 110% with 14px.


This doesn't work for the box with no alerts. :-(
Title: Re: New Weather Alert Program
Post by: Curly on April 01, 2013, 09:51:19 PM
Open nws-alerts.php.
Find both instances of this line:
Code: [Select]
.'<div style="width:'.$aBox_Width
Replace both instances with this:
Code: [Select]
.'<div style="width:'.$aBox_Width.'; font-size:110%'
That will take care of the font size for any alert.
To change the font size for a no alert message, find this line:
Code: [Select]
$box .= ' <div style=" '.$bc.' '.$tc.' padding:4px 8px 4px 8px; text-align: center"><a href="'
Change it to this:
Code: [Select]
$box .= ' <div style="font-size:110%; '.$bc.' '.$tc.' padding:4px 8px 4px 8px; text-align: center"><a href="'
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 10:11:30 PM
This is what I put and no changes?

Code: [Select]
     .'<div style="width:'.$aBox_Width.'; font-size:17px'
         .'; border:solid thin #000; margin:0px auto 0px auto;">'."\n";
    if($showNone) {                                                                          //   IF showing "NONE', create alert box with No Alert
      $box .= ' <div style="font-size:19px; '.$bc.' '.$tc.' padding:4px 8px 4px 8px; text-align: center"><a href="'
           .$summaryURL.'" title=" &nbsp;View summary" style="text-decoration:none; '.$tc
           .'">There are currently no active warnings, watches, or advisories in effect</a></div>
Title: Re: New Weather Alert Program
Post by: Curly on April 01, 2013, 10:13:13 PM
Any changes won't take affect until nws-alerts.php is ran.
Did you wait?
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 10:13:42 PM
Last update was at 9:03CST
Title: Re: New Weather Alert Program
Post by: cospringswx on April 01, 2013, 10:14:39 PM
Thanks Curly. One last thing.How  do I put text above like shown here http://www.cnyweather.com/index.php where his Central New York Severe Weather Alerts is?
Title: Re: New Weather Alert Program
Post by: CNYWeather on April 02, 2013, 07:42:37 AM
Ryan, I modified my NWSAlertBOX.php like so:

Code: [Select]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>NWS Alert Box</title>
</head>

<body>



<table border="0" cellpadding="0" cellspacing="0" style="margin: 0px auto 0px auto;">
 
<div>
<table border="0" cellspacing="0" cellpadding="0" style="width: 705px; margin: 2px auto 0px auto;">
<tr>
<td style="color: #000000; background-color: #C5C55B; text-align: center">CENTRAL NEW YORK SEVERE WEATHER ALERTS

<?php
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>
</tr></td>
</body>
</html>

Here's what it looks like: http://www.cnyweather.com/NWSAlertBOX.php

Then I just do a php include on my main page.
Title: Re: New Weather Alert Program
Post by: cospringswx on April 02, 2013, 12:21:41 PM
I didn't have a NWSALERTBOX.php on my server so I made one. Is this correct?   Is there anything else to edit? Then what?

http://hayskansasweather.com/nwsalertbox.php
Title: Re: New Weather Alert Program
Post by: cospringswx on April 02, 2013, 03:08:19 PM
Here is my index.php where the box is. What do I need to edit in this section?

Code: [Select]
?>

</head>
<body>
<?php include("nws-alerts.php"); ?>
<?php
############################################################################
include("header.php");
############################################################################
include("menubar.php");
############################################################################
//
$useTopWarning false;  // set to true to use only the rss-top-warning script
//                         set to false to use the rss-advisory script instead
?>


<div id="main-copy">
 <?php // insert desired warning box at top of page
if(isset($SITE['NWSalertsCodes']) and count($SITE['NWSalertsCodes']) > 0) {
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo '<div style="font-size:14px">'.$alertBox.'</div>';
?>

<script type="text/javascript" src="nws-alertmap.js"></script>
<?php
} else { // use atom scripts of choice
if ($useTopWarning) {
include_once(
"atom-top-warning.php");
} else {
print 
" <div class=\"advisoryBox\">\n";
$_REQUEST['inc'] = 'y';
$_REQUEST['summary'] = 'Y';
include_once(
"atom-advisory.php");
print 
" </div>\n";
}
}
?>
Title: Re: New Weather Alert Program
Post by: CNYWeather on April 03, 2013, 03:45:48 PM
SRY, busy day here Ryan.

Did you check out the index.php I sent you?

Title: Re: New Weather Alert Program
Post by: cospringswx on April 03, 2013, 04:30:45 PM
Yes. Mine shows  only the top of it and not the bottom part. Can't figure it out.  Figured out windows task scheduler to add multiple counties.
Title: Re: New Weather Alert Program
Post by: CNYWeather on April 03, 2013, 04:54:19 PM
put the snippet of your index up for me to look at later Ryan.

Where the <div id="main-copy"> after your sidebar in the index.php file begins
I think you're missing something because it doesnt look like my source code.
Title: Re: New Weather Alert Program
Post by: cospringswx on April 04, 2013, 04:02:39 AM
I think I got it here http://hayskansasweather.com/index.php
Thanks Tony for the help. I didn't do a php include I put a code in and it worked.
Title: Re: New Weather Alert Program
Post by: Saunookweather on April 04, 2013, 08:40:05 AM
Got it working on my site. Hope you don't mind me using it Tony.
Thanks for coming up with that code.


Jeff
www.saunookweather.com (http://www.saunookweather.com)
Title: Re: New Weather Alert Program
Post by: CNYWeather on April 04, 2013, 09:10:55 AM
Yep, not a problem guys. There's probably a better way to do it
and maybe one of the wizards of php will figure it out.

 :grin:
Title: Re: New Weather Alert Program
Post by: cospringswx on April 05, 2013, 01:07:42 PM
What does everyone have the setting set to on line 52 on nws-alerts-config? In other words how to you just have the advisory listed and the counties follow besides every county with duplicate advisories?


Code: [Select]
$sortbyEvent   = 0;                         // sort titles by severity in alert box & then by number listed below
//                                             0 = location - duplicate events will be displayed
//                                             1 = location - duplicate events removed
//                                             2 = event - duplicate events will be displayed
//                                             3 = event - duplicate events removed
Title: Re: New Weather Alert Program
Post by: cospringswx on April 05, 2013, 01:59:27 PM
Nevermind I figured it out. I had to change $sortbyEvent from a  0 to a 3 on the code below.


Code: [Select]
$sortbyEvent   = 3;                         // sort titles by severity in alert box & then by number listed below
//                                             0 = location - duplicate events will be displayed
//                                             1 = location - duplicate events removed
//                                             2 = event - duplicate events will be displayed
//                                             3 = event - duplicate events removed
Title: Re: New Weather Alert Program
Post by: cospringswx on April 06, 2013, 11:21:26 PM
There is a setting in NWSALERTBOX-config that you change no cron to false or true and the message will disappear
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 06, 2013, 11:23:34 PM
There is a setting in NWSALERTBOX-config that you change no cron to false or true and the message will disappear

I just removed the message after finding out that the config said true when I thought I had updated it to false. ](*,)
thanks for the reply though.
Title: Re: New Weather Alert Program
Post by: CNYWeather on April 20, 2013, 11:47:42 AM
Curly, wondering if there's a fix for this.

There are a couple River Flood Warnings here right now. Looking at the warnings, seems it may be for a river flood gauge and not an entire area?

This has been going on this spring here. Looks like it is for the river Gauge HIKN6 maybe. Weather Underground sends an alert for this.
Wonder if the alert program can show this also.

http://forecast.weather.gov/showsigwx.php?warnzone=NYZ037&warncounty=NYC065&firewxzone=NYZ037&local_place1=&product1=Flood+Warning

FLOOD STATEMENT
NATIONAL WEATHER SERVICE ALBANY NY
1138 AM EDT SAT APR 20 2013

NYC043-065-210338-
/O.EXT.KALY.FL.W.0006.130420T1537Z-130421T2100Z/
/HIKN6.1.ER.130420T1320Z.130420T1445Z.130421T1500Z.NO/
1138 AM EDT SAT APR 20 2013

THE FLOOD WARNING CONTINUES FOR
  THE WEST CANADA CREEK AT HINCKLEY.
* UNTIL SUNDAY AFTERNOON.
* AT 10 AM SATURDAY THE STAGE WAS 1227.2 FEET.
* FLOOD STAGE IS 1227 FEET.
* MINOR FLOODING IS OCCURRING AND MINOR FLOODING IS FORECAST.


It shows in the county code as a warning but the script isnt showing it.
http://alerts.weather.gov/cap/wwaatmget.php?x=NYC065

Thanks!
Tony

Title: Re: New Weather Alert Program
Post by: Curly on April 20, 2013, 02:08:28 PM
The NWS is not issuing a Flood Statement in their ATOM feed. Just the Flood Warning.
I have no fix for this.
Title: Re: New Weather Alert Program
Post by: CNYWeather on April 20, 2013, 05:23:15 PM
It shows on the SWSP Alert Script. That uses a different feed?
Title: Re: New Weather Alert Program
Post by: Curly on April 21, 2013, 07:41:24 AM
The SWSP scrapes web pages while the nws-alerts uses the XML/CAP v1.1 and ATOM Formats.
Title: Re: Re: Re: New Weather Alert Program
Post by: jonnyj771 on June 05, 2013, 12:30:01 AM
Curly, wondering if there's a fix for this.

There are a couple River Flood Warnings here right now. Looking at the warnings, seems it may be for a river flood gauge and not an entire area?

This has been going on this spring here. Looks like it is for the river Gauge HIKN6 maybe. Weather Underground sends an alert for this.
Wonder if the alert program can show this also.

http://forecast.weather.gov/showsigwx.php?warnzone=NYZ037&warncounty=NYC065&firewxzone=NYZ037&local_place1=&product1=Flood+Warning

FLOOD STATEMENT
NATIONAL WEATHER SERVICE ALBANY NY
1138 AM EDT SAT APR 20 2013

NYC043-065-210338-
/O.EXT.KALY.FL.W.0006.130420T1537Z-130421T2100Z/
/HIKN6.1.ER.130420T1320Z.130420T1445Z.130421T1500Z.NO/
1138 AM EDT SAT APR 20 2013

THE FLOOD WARNING CONTINUES FOR
  THE WEST CANADA CREEK AT HINCKLEY.
* UNTIL SUNDAY AFTERNOON.
* AT 10 AM SATURDAY THE STAGE WAS 1227.2 FEET.
* FLOOD STAGE IS 1227 FEET.
* MINOR FLOODING IS OCCURRING AND MINOR FLOODING IS FORECAST.


It shows in the county code as a warning but the script isnt showing it.
http://alerts.weather.gov/cap/wwaatmget.php?x=NYC065

Thanks!
Tony

Tony,
I noticed the zone code on the statement is not just your code. Apparently the statement is under this code:
 NYC043-065-210338-
/O.EXT.KALY.FL.W.0006.130420T1537Z-130421T2100Z/
Try checking the Atom feed under NYC043.
I do see the 065 in there, but I'm thinking the 043 is primary for this statement.
I apologize for not getting to this sooner. The flood warning has probably long since expired. Monitor the codes and see what changes.
Title: Re: New Weather Alert Program
Post by: Andy G on July 17, 2013, 08:49:00 AM
Trying to get my wxnws-alerts-log.php working

trying to get this page http://www.sunprairieweather.com/wxnws-alerts-log.php (http://www.sunprairieweather.com/wxnws-alerts-log.php) it is showing the alerts that were in the cache file from the zip file. So I think im most of the way there but my alerts are not writing to the cache file. Any ideas?

Thanks Andy
Title: Re: New Weather Alert Program
Post by: Curly on July 17, 2013, 05:44:27 PM
Trying to get my wxnws-alerts-log.php working

trying to get this page http://www.sunprairieweather.com/wxnws-alerts-log.php (http://www.sunprairieweather.com/wxnws-alerts-log.php) it is showing the alerts that were in the cache file from the zip file. So I think im most of the way there but my alerts are not writing to the cache file. Any ideas?

Thanks Andy

The config file is up to date but the main file, nws-alerts.php, is the old version without the logging option.
If you have downloaded the latest package here (http://www.weather.ricksturf.com/scripts/nws-alerts.zip), you may already have this file to upload, or you can download just the main file here (http://www.weather.ricksturf.com/scripts/nws-alerts121.zip).

Once the old version is replaced, the log file won't write until the next time nws-alerts.php is ran.
Title: Re: New Weather Alert Program
Post by: Andy G on July 18, 2013, 12:56:23 AM
Thanks Curly its working. I don't know how I missed that but missed it I did. Thanks for the script and the support. 

Andy
Title: Re: New Weather Alert Program
Post by: CNYWeather on July 18, 2013, 09:02:48 AM
Hey Curly.

I put the newer version of nws-alerts.php in and my config file says to log alerts.
Will I need to wait for some alerts before the alert-log file gets written to?

Also, is there a page nws-alerts-log.php template to call the alerts in a page correctly?

Thanks Rick!

EDIT I got this warning now also. I turned to logging off for now.
Code: [Select]
Warning: fopen(/NWSalertLog20130718.txt) [function.fopen]: failed to open stream: Permission denied in /home/content/62/3715862/html/nws-alerts.php on line 647
Title: Re: New Weather Alert Program
Post by: Andy G on July 18, 2013, 03:08:27 PM
Hey Curly.

I put the newer version of nws-alerts.php in and my config file says to log alerts.
Will I need to wait for some alerts before the alert-log file gets written to?

Also, is there a page nws-alerts-log.php template to call the alerts in a page correctly?

Thanks Rick!



Hi Rick there is this page wxnws-alerts-log.php for Ver 3 Templates. Is that what you are looking for?
Title: Re: New Weather Alert Program
Post by: CNYWeather on July 18, 2013, 03:24:34 PM
Yep, that was what I was looking for Andy. I found it when I re-downloaded the script from Curly.
Thanks!!!

I'm getting the error again. I assume something isnt writable?

Warning: fopen(/NWSalertLog20130719.txt) [function.fopen]: failed to open stream: Permission denied in /home/content/62/3715862/html/nws-alerts.php on line 647

It's Tony not Rick too.   :grin:
Title: Re: New Weather Alert Program
Post by: Curly on July 21, 2013, 07:49:43 AM
I had the links turned around that are listed a few messages back. (now fixed)
The alert log files are in the nws-alerts.zip file HERE (http://www.weather.ricksturf.com/scripts/nws-alerts.zip)


Quote
failed to open stream: Permission denied

That is the key phrase meaning that the script doesn't have permission to write files to the alertlog folder.
You will have to adjust the permission level (chmod) for the alertlog folder.

Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 02:35:36 PM
What am I doing wrong?

http://www.hayskansasweather.com/wxnws-alerts-log.php
Title: Re: New Weather Alert Program
Post by: CNYWeather on July 31, 2013, 02:47:56 PM
Did you download and upload the entire script Ryan?
Curly made a few changes to support this.

I had the same issue till I updated the entire script.
Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 03:05:26 PM
Had to add the code below to the config file. Now I'm trying to change the colors because I can't read anything.  :lol: How do I get it to read my area its currently reading Santa Clara,CA?
I've got the permissions on the alert log folder high BTW.



Code: [Select]
// ALERT LOGGING
$logAlerts     = true;                      // true=log alerts    false=don't log alerts
$log_folder    = './alertlog';              // folder that contains the log files. No slash on end


Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2013, 03:08:53 PM
The class is ajaxDashboard that has white text and it's in a white background.
I'll look into a fix for you this evening.
Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 03:13:08 PM
I can see the text on my iPhone but not on PC?
Title: Re: New Weather Alert Program
Post by: jgillett on July 31, 2013, 03:24:43 PM
I've got the permissions on the alert log folder high BTW.

FWIW, my /alertlog/ and /cache/ are both 775 (which actually might be a bit high), and all files within /alertlog/ are 644. Works fine.
Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 03:30:53 PM
I've got the permissions on the alert log folder high BTW.

FWIW, my /alertlog/ and /cache/ are both 775 (which actually might be a bit high), and all files within /alertlog/ are 644. Works fine.

Identical to mine but I'm still getting Santa Clara? :roll:
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2013, 03:47:00 PM
There are some tags missing in the nws-alerts-config.php file.
Open that file and add the following and then upload it:

Code: [Select]
$floodType     = true;                      // true=add prefix 'Areal' or 'River' to Flood alert title   false=no prefix to Flood alert
$noAlertText   = 'No Warnings, Watches, or Advisories';  // Text to display for no alerts.
Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 03:53:46 PM
There are some tags missing in the nws-alerts-config.php file.
Open that file and add the following and then upload it:

Code: [Select]
$floodType     = true;                      // true=add prefix 'Areal' or 'River' to Flood alert title   false=no prefix to Flood alert
$noAlertText   = 'No Warnings, Watches, or Advisories';  // Text to display for no alerts.


Done.

Edit:It just ran and it didn't change anything? Change permissions on alertlog folder to the highest?
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2013, 04:08:37 PM
I'm not seeing any php errors...
It would complain about permissions being denied if they were set too low.

Try turning on the error reporting in nws-alerts.php

Find this
Code: [Select]
//ini_set('display_errors', 1);
//error_reporting(E_ALL);

Replace it with this:
Code: [Select]
ini_set('display_errors', 1);
error_reporting(E_ALL);

Save it then upload it. Run the file manually
Report any errors.
You should comment out those two lines after you do this and upload the file again. This will prevent your index page from showing any php errors if there are any.

Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 04:16:22 PM
No errors reported Curly.
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2013, 04:55:32 PM
I'll look into it this evening.
Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 04:57:47 PM
I'll look into it this evening.

Ok. Thanks for the support.
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2013, 07:28:26 PM
Had to add the code below to the config file. Now I'm trying to change the colors because I can't read anything.  :lol:

Let's start with the color change.
Open wxnws-alerts-log.php and find this:
Code: [Select]
background-color:#FFF;
There will be 5 instances in the file. Change all 5  #FFF  to the color of your choice.

In the update script package, there is a small image file named lbg.png in the alert-images folder that needs to be uploaded to the same folder. That is a light background fill color for the alert title bar.
Title: Re: New Weather Alert Program
Post by: Curly on July 31, 2013, 07:58:48 PM
Quote
How do I get it to read my area its currently reading Santa Clara,CA?

Everything is in order as far as the settings and there are no scripting errors.
Have you had any alerts since updating?
Title: Re: New Weather Alert Program
Post by: cospringswx on July 31, 2013, 08:34:10 PM
Quote
How do I get it to read my area its currently reading Santa Clara,CA?

Everything is in order as far as the settings and there are no scripting errors.
Have you had any alerts since updating?

No alerts are in effect as of now here. At work so I can't do the color change.
Title: Re: New Weather Alert Program
Post by: cospringswx on August 01, 2013, 02:04:07 PM
Quote
How do I get it to read my area its currently reading Santa Clara,CA?

Everything is in order as far as the settings and there are no scripting errors.
Have you had any alerts since updating?

So the CA alert won't be replaced until I have an alert for my area?

http://hayskansasweather.com/wxnws-alerts-log.php
Title: Re: New Weather Alert Program
Post by: saratogaWX on August 01, 2013, 02:56:23 PM
You are not running the current version of nws-alerts.php -- V1.21 is the current version.

The version you are running is not "template aware" and that is the cause of your configuration issue.
Title: Re: New Weather Alert Program
Post by: cospringswx on August 01, 2013, 02:58:19 PM
You are not running the current version of nws-alerts.php -- V1.21 is the current version.

I downloaded the newest one yesterday. It's showing I'm running V1.21
Title: Re: New Weather Alert Program
Post by: cospringswx on August 01, 2013, 03:05:25 PM
You are not running the current version of nws-alerts.php -- V1.21 is the current version.

The version you are running is not "template aware" and that is the cause of your configuration issue.

Ok. Where is the one that I need to use. I downloaded the newest one?
Title: Re: New Weather Alert Program
Post by: CNYWeather on August 01, 2013, 03:11:40 PM
Here's 1.21 Ryan

http://www.weather.ricksturf.com/scripts/nws-alerts.zip
Title: Re: New Weather Alert Program
Post by: saratogaWX on August 01, 2013, 03:18:49 PM
Looks like it is working now.  

Use the check-fetch-times.php?show=versions and the link at the bottom of the page to easily get updates.
Title: Re: New Weather Alert Program
Post by: cospringswx on August 01, 2013, 03:22:32 PM
Still got CA alerts Ken?

http://hayskansasweather.com/wxnws-alerts-log.php


Here are my versions

http://www.hayskansasweather.com/check-fetch-times.php?show=versions
Title: Re: New Weather Alert Program
Post by: Curly on August 01, 2013, 05:42:25 PM
Quote
So the CA alert won't be replaced until I have an alert for my area?

You won't get a logged alert file until a location gets an alert. So far I haven't seen any alerts for the 11 locations since you've updated.

The California alert log is a sample file in the alertlog folder.  NWSalertLog20130505.txt   
You can delete that file now, and it will show nothing on the log web page, or delete it after you get the first alert from your locations.

OR

You can open up the log file and add something custom temporarily.
Open alertlog/NWSalertLog20130505.txt
Delete everything and replace it with this:
Code: [Select]
<?php 
 
$daily_log 
= array (
  
=> 
  array (
    
=> 'No alerts logged',
    
=> 'ELLIS COUNTY',
    
=> 1371095040,
    
=> 1371154800,
    
=> 'NPW.gif',
    
=> 'ELLIS COUNTY',
    
=> 'No alerts logged for this day',
  ),
);

?>
Title: Re: New Weather Alert Program
Post by: cospringswx on August 02, 2013, 11:54:29 AM
Everything is working fine. Thanks for the help and support getting this working. :grin:

 http://hayskansasweather.com/wxnws-alerts-log.php
Title: Re: New Weather Alert Program
Post by: jgillett on January 14, 2014, 07:29:08 PM
Hi Curly,

Suddenly yesterday started getting a pile (like >100) of the following in my php_error_log...

[14-Jan-2014 17:15:09 America/Phoenix] PHP Warning:  array_search() expects parameter 2 to be array, null given in /home/tigercon/public_html/tiggrweather.net/AtomAlerts/AtomFeed.php on line 309
[14-Jan-2014 17:15:09 America/Phoenix] PHP Warning:  array_search() expects parameter 2 to be array, null given in /home/tigercon/public_html/tiggrweather.net/AtomAlerts/AtomFeed.php on line 548

Most are for line 309. Have not touched this script in ages.

Thoughts appreciated.

EDIT: This started 2 days ago and is throwing errors every 15 minutes. Needless to say, there are currently almost 3900 error lines in the log.
Title: Re: New Weather Alert Program
Post by: Curly on January 15, 2014, 05:16:05 AM
I'm not seeing any errors when executing the AtomFeed script.
Could this be on a home server ?
Title: Re: New Weather Alert Program
Post by: jgillett on January 15, 2014, 10:31:17 AM
I'm not seeing any errors when executing the AtomFeed script.
Could this be on a home server ?
Nope - no home server.

But - after talking to the host late last night about some really funky errors that were also showing up it turns out to have been a problem with a PHP update to 5.4 that they just did (with no notification at all to me). The php.ini was not being properly seen by my site, which the rep fixed on the spot. I zeroed out the php_error_log last night and it's still zero this morning (it was hitting multiple times every 15 minutes, which makes sense). Very annoyed about their lapse.

Sorry for the bother, but thanks for the reply.
Title: Re: New Weather Alert Program
Post by: Curly on January 23, 2014, 07:21:41 PM
UPDATE

With the upgrading of php, the file nws-alerts.php has a strict error message about a line in the code.
This is fixed in the latest version 1.23.
You can  download just the file nws-alerts.php here (http://www.weather.ricksturf.com/scripts/NWSalerts_123.zip)
or download the complete package here. (http://www.weather.ricksturf.com/scripts/nws-alerts.zip)

Unzip the file and upload nws-alerts.php. There is nothing to configure.

Thanks
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 06, 2014, 04:20:17 PM
Curly,

I am using the stand-alone version of the nws-alerts script on my site. I have updated my pages with the Leuven Template ( Leuven Template forum post page (http://www.wxforum.net/index.php?topic=18819.0))

I am attempting to use the nws-alerts script with this template. Currently, I have no alerts in my area (could be part of the problems). My issues are:
500 internal server error when I attempt to go to the page http://lightningweather.com/weather2/nws-alerts/nws-alerts.php?mu=1 (http://lightningweather.com/weather2/nws-alerts/nws-alerts.php?mu=1) to manually update the script.  I also have the same error when I attempt to go to the summary and details pages.

If I go to the Advisory page (http://lightningweather.com/weather2/index.php?p=57-3) which is how I have the wsmenudata.xml set up (for security purposes) I get the page open and blank with no errors.

I have the nws-alerts.php file set to show errors and both my settings page and my nws-alerts-config.php files show where the files/folders are properly located. I have also set 'show no alerts' to true. I am including the text files for these in this.

Is is possible that I am getting these errors due to the lack of alerts or permissions? all of my permissions are set at either 775 or 777 (any lower and I get "file does not exist" errors).  ](*,)

I also have a cron job set up on my computer using Windows7, I used the Setup VistaCron files/instructions as they are nearly identical to Windows7's settings.

I know most everyone in this forum is using a Saratoga-based template (which are good and have no objections to, I just dare to be different) :lol:

Do you have any ideas as to my issues and how to solve them?
Title: Re: New Weather Alert Program
Post by: cospringswx on April 06, 2014, 04:27:20 PM
Must be a Cron job issue. I run a vbs file in Windows Task Scheduler.
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 06, 2014, 04:29:24 PM
Must be a Cron job issue. I run a vbs file in Windows Task Scheduler.

Ryan,

I appreciate the quick reply. I am using the .vbs file in Windows Task Scheduler. Set for 10 minute intervals.

Edit: I went to the WxStation Computer running the Cronjob...Verified that the task was running without any problems. I enabled the history to make sure if there were errors, that I was able to locate and correct them. It's returning successful tasks since 1:41 PM CDT. (all set on odd minute)
Title: Re: New Weather Alert Program
Post by: cospringswx on April 06, 2014, 04:50:15 PM
Why are you running both? From my understanding only 1 is required. I would keep the task scheduler. Do u have it running for 10 minutes indefinitely? They might be conflicting?
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 06, 2014, 05:11:14 PM
Why are you running both? From my understanding only 1 is required. I would keep the task scheduler. Do u have it running for 10 minutes indefinitely? They might be conflicting?

I'm only running the one task. My hosting Provider (iPage) doesn't provide Cron-tasks.
Title: Re: New Weather Alert Program
Post by: Curly on April 06, 2014, 05:34:05 PM
Jonny J,

I don't know what is causing the internal server error but it could be from the script attempting to write files.
You will need to locate and change three file paths in the file nws-alerts-config.php to the paths below.

Code: [Select]
$cacheFileDir  = './alerts-cache/';         // default cache file directory
$icons_folder  = './alert-images';          // folder that contains the icons. No slash on end

$log_folder    = './alertlog';              // folder that contains the log files. No slash on end

After the changes, upload the file and manually update the file nws-alerts.php.
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 06, 2014, 05:42:10 PM
Jonny J,

I don't know what is causing the internal server error but it could be from the script attempting to write files.
You will need to locate and change three file paths in the file nws-alerts-config.php to the paths below.

Code: [Select]
$cacheFileDir  = './alerts-cache/';         // default cache file directory
$icons_folder  = './alert-images';          // folder that contains the icons. No slash on end

$log_folder    = './alertlog';              // folder that contains the log files. No slash on end

After the changes, upload the file and manually update the file nws-alerts.php.

Curly,

I have those files/folders located in the weather2/nws-alerts folder(s).
should I move those out to the root and note in the code?
Title: Re: New Weather Alert Program
Post by: Curly on April 06, 2014, 06:17:59 PM
Quote
I have those files/folders located in the weather2/nws-alerts folder(s).
should I move those out to the root and note in the code?

The paths are relative to where nws-alerts.php is located.
You have that file here: /weather2/nws-alerts/nws-alerts.php
The cache folder is here: /weather2/nws-alerts/alerts-cache/
So the path would be  $cacheFileDir  = './alerts-cache/';

Since you have the main file in a separate folder, the paths to the icons and details probably won't work correctly if the web pages are in another folder.
The files in the folder nws-alerts should be in your weather root folder where all of your web pages resides.

Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 17, 2014, 09:07:28 PM
Curly,

I got the pages going properly (sort of)... When you go to the site  advisories page (http://lightningweather.com/weather2/index.php?p=57-3) The page shows blank, aside of the template.  If you make it the summary page, you get the summary, then clicking on each county will get you a separate page and but doesn't include the template.
I'm using the Leuven Template. Although there is an advisory script, it's only designed for 1 Zone or County Code. Not a Zone|County Code. It's also not designed for multiple zones.
When you go to do the ?mu=1 it does update the summary. I also have a cron job running.

I have posted this just about a week ago.  I was originally having 500 internal server errors, but that has since been corrected.

Can you get me some idea of what I am missing?

Regards,
Jonny J
Title: Re: New Weather Alert Program
Post by: Curly on April 18, 2014, 05:20:12 AM

I see that the file nws-alerts.php is included in the page and according to the settings, you have nws-alerts.php set to use a cron job.
Each time you visit the advisories page, all it does is update the cache files.
The code to get the summary on the page is this:
Code: [Select]
<?php include("nws-alerts-summary-inc.php"); ?>
The page with the details should have this code:
Code: [Select]
<?php include("nws-alerts-details-inc.php"); ?>
To view the alert box, this code gets placed in the web page:
Code: [Select]
<?php
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>

The summary page and details are showing up here:  http://lightningweather.com/weather2/nws-summary.php
Both of theses files are working as set in the file nws-alerts-config.php

Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 18, 2014, 08:19:55 AM

I see that the file nws-alerts.php is included in the page and according to the settings, you have nws-alerts.php set to use a cron job.
Each time you visit the advisories page, all it does is update the cache files.
The code to get the summary on the page is this:
Code: [Select]
<?php include("nws-alerts-summary-inc.php"); ?>
The page with the details should have this code:
Code: [Select]
<?php include("nws-alerts-details-inc.php"); ?>
To view the alert box, this code gets placed in the web page:
Code: [Select]
<?php
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>

The summary page and details are showing up here:  http://lightningweather.com/weather2/nws-summary.php
Both of theses files are working as set in the file nws-alerts-config.php

Curly,

I switched my settings around to show the summary page as my advisory page. When you click on the advisory/no alert for each county, it takes you to the details, however, it's not showing the template. that would make some want to just go elsewhere (alot don't like the back button).
any remedy for this?
Title: Re: New Weather Alert Program
Post by: wvdkuil on April 19, 2014, 08:34:52 AM
Good morning, I am the developer of the Leuven-Template and just started to implement the very nice loking Curly's alerts scripts into the Leuven-Template.

My first 'adaption' works at http://www.weerstation-leuven.be/northam/ (http://www.weerstation-leuven.be/northam/).

I added a combined summary/details page to the menu http://www.weerstation-leuven.be/northam/index.php?p=57-3 (http://www.weerstation-leuven.be/northam/index.php?p=57-3)
Clicking on a link on the summary page or on the alert-box on top of the page brings you to the detailed information.

I will as always keep the adaption in someone elses scripts to the absolute minimum.
As for now I only have to change a few ? in the url-links to a &
The template itself is uses the ? to refer to the pagenumber.
 
I also changed the css for the alert box to have the same look as the rest of the page , but all will be documented.

Remaining questions:
nws-alertsIconData.php does anyone has a link to a page where they are used?
I understood that they are sometimes added to the menu-area but also if there are multiple warnings?
Thunder and severe rain/snow warning As with the current euro/noaa script I want to include a small version of the thunder-page or rain-radar when such a warning is in effect. I have to find out where to raise the condition for those warnings.

It will take a few days before everything is runnig smoothly enough to distribute the scripts.

Wim
Title: Re: New Weather Alert Program
Post by: Curly on April 19, 2014, 09:15:27 AM
Quote
I switched my settings around to show the summary page as my advisory page. When you click on the advisory/no alert for each county, it takes you to the details, however, it's not showing the template. that would make some want to just go elsewhere (alot don't like the back button).
any remedy for this?

What is the file name (page number) for the template page for the details?
Title: Re: New Weather Alert Program
Post by: wvdkuil on April 19, 2014, 09:29:18 AM
Quote
I switched my settings around to show the summary page as my advisory page. When you click on the advisory/no alert for each county, it takes you to the details, however, it's not showing the template. that would make some want to just go elsewhere (alot don't like the back button).
any remedy for this?

What is the file name for the template page for the details?
The "file-name" in the Leuven-Template does not refer to an exact script-name. For the details page jonnyj771 is using (and so do I) for the name in the browser window index.php?p=57-3 and that is what has to be set in the $alertURL variable.
In the menu xml file the number 57-3 is linked to a script to handle that menu choice.

As the handling is identical between summary and detail I choose to have only one php-script for summary and details. And based on the &a=xxxxxx get setting I include either the summary or details inc scripts.
Code: [Select]
if (isset ($_REQUEST['a']) && '' <> trim($_REQUEST['a']) ){
include ('nws-alerts-details-inc.php');
} else {
include ('nws-alerts-summary-inc.php');
}
So I already posted this script to jonnyj771 in another thread.

Again very fine scripts, very easy to integrate into ones website or into a template. I wish I had known your scripts before I wrote my own NOAA alert script.

Wim
Title: Re: New Weather Alert Program
Post by: Curly on April 19, 2014, 10:02:27 AM
Quote
Remaining questions:
nws-alertsIconData.php does anyone has a link to a page where they are used?
I understood that they are sometimes added to the menu-area but also if there are multiple warnings?
Thunder and severe rain/snow warning As with the current euro/noaa script I want to include a small version of the thunder-page or rain-radar when such a warning is in effect. I have to find out where to raise the condition for those warnings.

The cache file nws-alertsIconData.php is generally included in the menubar which is set by the tag $iconFileName.
Icons have the tag $bigIcons. You can see this used in the left menu bar under County Alerts. http://www.weather.ricksturf.com/WX/wxNWSforecast.php
There are 6 settings on how to display the large icons including the most severe alert icon for a location or all icons for all alerts. Sometimes there can be multiple alerts with the same alert name and those can be regulated in the config file.

All of the alert data is in the cache file nws-alertsMainData.php.
In that file, the first tag will be $atomAlerts. It will be empty if there are no alerts.
When there are alerts, the tag will have an array for each location with the alert(s) starting with the most severe alert listed first. If you want to check for specific alerts for the thunder-page or rain-radar, a few lines of php code could get you the results.
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 19, 2014, 10:41:29 PM
Curly,

I have the page up and running now. I have noticed with an alert I have going, It's a River Flood Warning on the Mississippi at Dubuque. The icon is showing Flash Flood Warning. I have it set in the Config file as 'true' to show "river and aerial" warnings.

Advisories Page (http://lightningweather.com/weather2/index.php?p=57-3)
I'm wondering where I look to check what icon the alert is supposed to be displaying and how to change it so it shows "R" for the River Flood Warning (as the legend depicts.)

Regards

Jonny J.
Title: Re: New Weather Alert Program
Post by: Curly on April 20, 2014, 12:53:23 AM
Open nws-alerts.php and find this line:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FFW.gif'),

Replace it with this:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FLW.gif'),
Title: Re: New Weather Alert Program
Post by: jonnyj771 on April 20, 2014, 01:07:16 AM
Open nws-alerts.php and find this line:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FFW.gif'),

Replace it with this:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FLW.gif'),

Fixed it.
Thanks Curly!!
Title: Re: New Weather Alert Program
Post by: mkutche on December 03, 2016, 06:30:40 PM
my alert log doesn't seem to be working.. http://gosportwx.com/wxnws-alerts-log.php shouldn't it display the current day or no, and I know I've had more alerts since November 29th and well before?
Title: Re: New Weather Alert Program
Post by: Curly on December 04, 2016, 09:52:39 AM
The log file only stores the brief information for active alerts.
If there are no alerts for a day, that day doesn't get logged.

Looking at the the SPC Storm Reports and the Local Storm Reports for your area, nothing is displayed for your area in the last 4 days.
You if have alerts and it's not logging them, check the  alertlog  folder for proper file writing permission.
Title: Re: New Weather Alert Program
Post by: Bunty on January 13, 2017, 11:53:06 PM
How do I set things to make the link go straight to the nws-details.php page, rather than nws-summary page?  Also does the Google  map feature no longer work?
Title: Re: New Weather Alert Program
Post by: Maumelle Weather on January 14, 2017, 07:32:20 AM
Hi Bunty,

Look in your nws-alerts-config.php file for the following:

// file names
$cacheFileName = 'nws-alertsMainData.php';  // main data cache file name
$aboxFileName  = 'nws-alertsBoxData.php';   // alert box cache file name
$iconFileName  = 'nws-alertsIconData.php';  // big icons cache file
$alertURL      = 'wxnws-details.php';       // web page file name for complete details - Used with Saratoga Base USA template
//$summaryURL    = 'wxadvisory.php';       // web page for the alert summary - Used with Saratoga Base USA template
//$alertURL      = 'nws-details.php';       // web page file name for complete details - Used for standard web pages
$summaryURL    = 'nws-summary.php';       // web page for the alert summary - Used for standard web pages

Yours may look very similar. Put 2 forward slashes in front of the one in orange and remove the ones in red. This should make both links the same.

Hope this helps,

John