Page 1 of 1
Need help modifying NOAA-reports.php
Posted: Sun 16 Feb 2014 1:03 pm
by XBower
Hi guys.
I'm not very much into php programming, so I could do with a little help modifying the NOAA-reports.php script.
I have been running this script on my site for almost a year, and it works just fine for every newly produced report that gets uploaded.
What I'm trying to do now is displaying a bunch of reports that I have generated from data from an old station I had running back in the 90s.
No problem uploading these reports to a seperate directory and modifying the script to read from that directory.
But the menu generated is not a pretty sight.
I have reports from 1994 up 2000 in my directory.
The menu shows all greyed out years/months all the way up till today.
Is there any way that I can modify the script to only show the years that I actually have reports from in the menu?
Perhaps hardcode the years 1994-2000 somewhere would also work.
I have tried to fiddle a bit with the $first_year and $last_year, but I can't get it right.
Any help will be highly appreciated.
Regards
XBower
Re: Need help modifying NOAA-reports.php
Posted: Sun 16 Feb 2014 1:49 pm
by beteljuice
This should be posted under the right topic.
You don't modify the php file - you modify (if necessary) your old data files content to be in the same format as the Cumulus generated ones and make sure they have the correct name format.
Re: Need help modifying NOAA-reports.php
Posted: Sun 16 Feb 2014 3:03 pm
by SpaceWalker
It is possible to modify the 'include-NOAA-reports.php' script to specifically read (and process) the data format of the reports from 1994 up 2000 - I have modify my script to also read the data produced by Weather Display.
Re: Need help modifying NOAA-reports.php
Posted: Sun 16 Feb 2014 4:23 pm
by XBower
Hi.
Sorry if I posted this in the wrong place, moderator - please free to relocate as appropriate.
I don't have any problems with the data format.
The reports in question are created and uploaded OK, they display fine.
But when I run the script to display them it looks like:
http://berand.net/weather/cumtest/NOAA-reports-old.php
Expand the menu, and I think You get my point.
All those greyed out lines from 2001-2014 are naturally because I don't have any reports for these years in this directory.
I just want to get rid of these lines from the menu.
Can I do it?
Regards
XBower
Re: Need help modifying NOAA-reports.php
Posted: Sun 16 Feb 2014 7:14 pm
by XBower
Hi.
Just solved this.
Line 166 in the script reads: $now_year = $now['year'];
I simply changed this to: $now_year = 2000;
Now, the 'menu' only shows years 2000-1994, just as I wanted it.
Thanks guys.
XBower
Re: Need help modifying NOAA-reports.php
Posted: Sun 16 Feb 2014 8:05 pm
by beteljuice
Err ... 'now' is 2014
Why are you trying to run two versions of the script instead of one ?
Re: Need help modifying NOAA-reports.php
Posted: Mon 17 Feb 2014 7:33 am
by XBower
beteljuice wrote:
Why are you trying to run two versions of the script instead of one ?
Hi.
I ran into some problems with the reports 'menu' if I just put my old reports together with the newer ones.
It turned out that the script shows some "empty" rows for the years I don't have any reports for.
Naturally it would be better to modify the script to ONLY show rows for the years that I actually HAVE reports for, but I just don't know how.
Using two scripts with seperate report directories do offer a somewhat useable, but not very elegant solution.
Any ideas on how I can modify the script not so show "empty" rows in the menu is welcome.
Regards
XBower
Re: Need help modifying NOAA-reports.php
Posted: Mon 17 Feb 2014 1:02 pm
by beteljuice
No gaurantees and should only work with CU option.
Should be good for all records. - maybe !
Edit: download link removed - superceded by below:
Re: Need help modifying NOAA-reports.php
Posted: Mon 17 Feb 2014 3:54 pm
by XBower
Hi.
Can't tell You how much I appreciate Your help with this.
I moved all my reports (old and new) to my 'normal' directory, uploaded Your modified script, and the result You can see here:
http://berand.net/weather/cumtest/NOAA-reports-MOD.php
You can see it's almost perfect, just some rows 2099-2094, don't know where these came from.
Regards
XBower
Re: Need help modifying NOAA-reports.php
Posted: Mon 17 Feb 2014 7:28 pm
by beteljuice
Aha !!!!
CUmulus stores month reports with a 2 digit year in the name - thus only good for one century then they will overwrite each other
Try this - should give you 1990 => 2089 (hope that's long enough)
NOAA-reports-MOD.zip
Re: Need help modifying NOAA-reports.php
Posted: Mon 17 Feb 2014 9:36 pm
by XBower
Hi.
Thanks a million......
Well, as they say, "I don't plan to live forever"... not even to 2089 for that matter.
This one works perfect, just the way I wanted it, no 'empty' rows in sight, great.
Once again, thanks a lot, appreciate it.
Regards
XBower