PHP Extraction of WD Avg/Ext HTM Files

Hi MCHALLIS

Thanks for your reply and development of great scripts.

I have now added the code to my head section.

But im in doubt what to change in the avgextract.php script.

Could I ask you to send the code section of the .gif

Try this:


                    if ( $DAY != 0 ) {
                        echo "</table>\n";

                          $this_img = $yearnum . $monthnum . $DAY;
                        # mchallis added if is_file check and image toggle feature
                        if (is_file("$website$this_img.gif")){
                         echo '
<p onclick="toggleDisplay(\'img_\' + '.$this_img.');">
Klik her for 24 timers graf for denne dag</p>
<img src="'. $website . $this_img .'.gif" id="img_'.$this_img .'" style="display: none" onclick="toggleDisplay(\'img_\' + '.$this_img.');" alt="24 hour Chart for Day '.$DAY.'" title="24 hour Chart for Day '.$DAY.'" />' . "\n";
                        } else {
                            echo "24 timers graf for denne dag is not available ($this_img.gif)
 
" . "\n";
                        }

                    }
                    preg_match("/Ekstremer for dag :(\d{1,2})\</",$value,$found);
                    $DAY = $found[1];
                    echo "<h3>Gennemsnit &amp; rekorder for dag " . intval($DAY) .
                        "</h3><table class='tbl'>";
                }

               // Check for Month Recap

                if ( strpos ($value, "Ekstremer for m

Hi again

Thank for your reply and help - but unfortunately I cant get it working.

See this link: http://www.buskelundtoften.dk/vejret/rapporter.php

It says “24 timers graf for denne dag is not available (20080101.gif)”

What do you think can be the problem?

Best regards,

Henrik

Henrik,

It is looking for th graph gif files in
http://www.buskelundtoften.dk/vejret/
but you have them in
http://www.buskelundtoften.dk/vejret/vejrdata/

You have the script and data in different directories so the script is not checking the if is_file correctly
What is your $website setting inside AvgExtract.php set to?

Hi again,

In the avgextract.php my website is set to:

$website = “http://www.buskelundtoften.dk/vejret/vejrdata/”;

I have experimented by copying 20080301.gif to the www.buskelundtoften.dk/vejret folder - but it still dont work.

Hope you can figure something out.

Thank you very much for all your help

Best regards,

Henrik

Henrik,

Try this setting for $website:
$website = “…/…/vejrdata/”;

Also for the javascript toggle to work, make sure to put this in the head of the page dagligrapporter.php:


<!-- mchallis begin added for toggle 24 Hour Daily Chart images -->
<script type="text/javascript" language="JavaScript">
function toggleDisplay(imgID) {
   if(document.getElementById(imgID).style.display == "none" ) {
            document.getElementById(imgID).style.display = "";
   } else {
            document.getElementById(imgID).style.display = "none";
   }
}
</script>
<!-- mchallis end added for toggle 24 Hour Daily Chart images -->


Hi

Woo hoo that did the trick (for my Danish version).

Now I tried changing my English version located here:

www.buskelundtoften.dk/vejret/english/rapporter.php

Location of the dagligrapporter and avextract.php is here: www.buskelundtoften.dk/vejret/english/scripts/rapporter/

I changed the $website to:

$website = “…/…/…/vejrdata/”;

Hmm im just not good at this php coding :smiley:

Best regards,

Henrik

Just for testing

change this
echo "24 hour graph for this day is not available ($this_img.gif)

" . “\n”;

to this
echo "24 hour graph for this day is not available ($website$this_img.gif)

" . “\n”;

Then I can see why it is not working

Hi

Wow you are fast.

I have changed the line now.

Again thanks for all your help.

Best regards,

Henrik

Henrik,

You can take that testing code out, the path is not the problem, the sate used for the input is the problem

The code you have is looking using a date like this [year][month][day]: 2008301 (notice the month you have is [3], it should be [03]
It is supposed to be like this: 20080301

The date is used to put together the image file name, but the missing a zero before the 3 makes it incorrect
2008301.gif instead of 20080301.gif

now the question remains why is the date for month missing a zero?

Hi Mike

Ups - I did a compare at the avgextract.php to my Danish and English version and there were some differences.

I corrected that, and now I have the script working both on my Danish and English site.

Thank you very much for your help on this - i apreciate it wery much.

Now - I only have one more question (sorry). How did you manage to make your rows light and dark? As far as I can see I have a left and right colomn.

All the other placed on my website, I use light and dark rows in my tables.

Thank you very much.

Best regards,

Henrik

He uses a different CSS class for each row…

`

`

Hi Kevin

Thanks for your reply.

To get the rows dark and light after eachother - there must have been changed in the avextract.php script?

Here is what I have in the script:

         echo "<tr><td class='left'>" . 
                    $left .
                    "</td><td class='right'>" .
                    $right .
                    "</td></tr>\n";

Left and right - but how do I change that to dark and light - every second row?

Best regards,

Henrik

Henrik,

I have attached the version I made for ken’s wd templates, I added many comments, you can compare if you like, but it does use 3 css classes from the wd template css table-top, column-light, and column-dark.


include-get-month-files.txt (5.25 KB)

Hi Mike

Thanks for your reply.

Im not sure where you set the table-row-dark and light - do you specify that in Kevins avgextract.php?

Best regards,

Henrik

table-top, column-light, and column-dark. are part of the CSS files included with the
Weather Display/PHP/AJAX Website Template Set
http://saratoga-weather.org/template/ for which include-wxhistory.php was adapted for

Hi Mike

Ohh now I understand - I have modified my report page and its working great. And im using my css file.

http://www.buskelundtoften.dk/vejret/english/rapporter.php

Thank you very much for all your help.

Best regards,

Henrik

I have attached an updated AvgExtract.php file.
This version supports WD V10.37j+

Since Brian did the rewrite of the Avg/Ext in WD V10.37j+, this file had to be updated.
My fixes are backward compatible with the reports generated with the earlier version.
Rename it from AvgExtract.php.txt to AvgExtract.php then upload it to your server to replace the current AvgExtract.php

Edit: see my later post from 04/06/08 for the download

Hi Mike

What are the changes you have made?

I run a modified script because my wd files are in Danish.

Best regards,

Henrik

If you look in the file, I commented all the changes with

mchallis 04/04/08