PHP Extraction of WD Avg/Ext HTM Files

All fixed and even better than before :slight_smile:

I want to note that this is designed to be a plugin for Kevin’s “PHP Extraction of WD Avg/Ext HTM Files” script

script available at
http://www.carmosaic.com/weather/scripts/include-get-month-files.php?sce=view

Version 2.0 - 01-Jan-2008 - fix: find default month, make sure it exist
added feature: verify inputted date file exist, use default if it does not
version 2 requires changes in the how to use section
refer to “How to use it:” section at the top of the script

I tried to implement the script, but it does not display anything. I probably messed something up, but darned if I can see what it is. My page is [url][http://www.lesdiefenbach.org/wx/test-stats.phpurl]Can you see anything obvious? I only have December2007.htm available for data.

dafuser,

Did you first install the tnet scripts and get them working before trying my plugin?
You need to have installed the AvgExtract.php and the sample.php from the tnet site, get that working, and then finally install my plugin.

Start here:
http://www.tnetweather.com/tws-avgext-script.php

was I any help?

It’s installed and working like a dream Mike. :smiley:

Thanks for that.

Someone pointed out to me a page header title inconsistency and I have the fix …

January2007.htm page title was “Daily Report for the month of January 2007”
and January2008.htm page title was “Daily Report for the month of 01 2007”

Here is the fix that will use “January” in both pages

inside AvgExtract.php

change


preg_match("/Daily report for (.*)\</U",$value,$found);
$month = $found[1];

to


// mchallis page title consistancy fix ....
// January2007.htm page title was "Daily Report for the month of January 2007"
// and January2008.htm page title was "Daily Report for the month of 01 2007"
$month = $mnthname[$monthnum -1 ] . " $yearnum"; 

i translate the script in italian http://www.folignometeo.net/foligno/sample.php but there is a little problem with the day numbers… it’s always 0 :roll: :roll: :roll:

Alexb

In AvgExtract.php
The line that was


preg_match("/Extremes for day :(\d{1,2})\</",$value,$found); 

What did you change it to? Or did you not change it?

I’m not change nothing here the code:

preg_match("/Medie \ estremi per il giorno:(\d{1,2})\</",$value,$found);
                    $DAY = $found[1]

Alexb

There were two errors in your preg_match
the slash was not properly escaped and there was not a space after the colon

Change it to this …


preg_match("/Medie \\\ estremi per il giorno: (\d{1,2})\</",$value,$found); 

Thanks MCHALLIS, now works very well, http://www.folignometeo.net/foligno/sample.php

Only the rain day at the end of page don’t appers.

Hi

I can see that Brian has updated the av/ext .html file - here is what he writes on the www.weather-display.com history page:

20th Feb 10.37i build 9 .zip update: Added daily rain for each day to the av/ext .html, and the month rain total now adds up when recreating that

Would above have any influence to the script?

Best regards,

Henrik

I would guess that it has no effect on the script since the script looks for the information if it is there or not. Having it there all the time simply means it would find it each time.

Hi Kevin

Thanks for your reply.

I will have a go for it.

Best regards,

Henrik

Hi

Anyone tried to incoporate this script into Ken True’s templates, so it can be called from menu and be using the CSS already defined. Maybe it is easy, but I’m not a guru with PHP and CSS.

Thanks

Rgds
Gert

Gert,

I have this script running in a Ken True template:
http://www.carmosaic.com/weather/monthly-stats.php

I can work on integrating the style into my color theme switcher maybe Saturday or Sunday. I will be too busy today and tomorrow.
What I will do is make the style compatible, then make a sample page for the new templates and zip it up and send it to Ken to add to the distro.

Hi Mike

That sounds really good. Looking forward to try it out.

Thanks

Rgds
Gert

I’ve implemented this script on my site but it isn’t showing the degree symbol correctly:

http://www.theweathertoday.co.uk/avgext.php

They look OK when I use the sample script:

http://www.theweathertoday.co.uk/avgtest.php

so I thought it was a CSS thing. However, when I remove CSS completely, they still display incorrectly:

http://www.theweathertoday.co.uk/avgext-no-css.php

Can anyone explain this?

Thanks.

Lets try changing this

to what’s in the example and see how that works.

  • Jim

That did it, thanks!

It’s strange though, because the rest of the site uses the same character set and all those pages display the symbol correctly. :roll:

It’s great that there are people here who know what they’re talking about to help those of us who blindly hack, slash, cut and paste bits of code into pages without knowing what half of it does :wink:

Thanks again.

What do you think of this?
http://www.carmosaic.com/weather/monthly-stats.php

Try out the toggle 24 Hour Chart daily image feature (the image links are at the bottom of each daily table)

I have modified and repackaged AvgExtract.php into include-wxhistory.php
I am sending two files (wxhistory.php and include-wxhistory.php) to Ken to be used as a plugin for use in
the Weather Display/PHP/AJAX Website Template Set

Features / Changes:
Modified for style compatibility with my css theme switcher and to be used
inside of a wxhistory.php page in a Weather Display/PHP/AJAX Website Template set

Added if is_file check and toggle image feature for 24 hour chart images
also added other minor formatting changes like


This version of AvgExtract.php I have developed into include-wxhistory.php
At this time, is only designed to be used as a plugin for use in
the Weather Display/PHP/AJAX Website Template Set because it has css style changes inside include-wxhistory.php.
include-wxhistory.php should not be used outside of the Weather Display/PHP/AJAX Website Template Set or it will not work right.