Author Topic: Today/Yesterday: High/Low timestamp not updating unless page is Refreshed  (Read 2775 times)

0 Members and 1 Guest are viewing this topic.

Offline pablo

  • Member
  • *
  • Posts: 32
Howdy,

On the main `index.php' page, there's a little matrix:

Code: [Select]
              Today           Yesterday
High:        20C                 22C
            4:33pm             4:38pm

Low:          2C                  3C
            6:00am              6:02am

On my page, the temperatures do update when the page auto-updates.  The problem is the timestamps do not unless I do a hard refresh on the page:  CTRL-Refresh.

How can I force the timestamp to update along with the temperatures?

I'm using php5 and Firefox.

Cheers.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Hi Pablo,

In the template ajax-dashboard.php, the only the Today High and Today Low temperatures are available in clientraw.txt for AJAX updates .. the Today High/Low times, and all of Yesterday's values are from testtags.php (PHP) so only get updated when the page is refreshed in the browser.   In this diagram, only the red underlined variables are updated by AJAX .. the rest are by PHP only (because they aren't available in clientraw.txt).



Hope this helps...
Best regards,
Ken
« Last Edit: October 14, 2008, 12:09:47 AM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline pablo

  • Member
  • *
  • Posts: 32
Hi Ken,

I had to digest this a bit but I believe I understand the issue.

The AJAX code is re-reading the `clientraw.txt' file when it changes.  And when it changes, it repaints those data values on the screen.

The `testtags.php' file is read once when the page is first presented.

Given that `testtags.php' has some data which updates periodically, the high/low timestamp for example, is there a way you can think of to have the page auto-paint that data?

I don't mind hacking on the .php code .. I get a general feel of what it's doing ... but I'm not a PHP or an AJAX developer.  :)

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
That's correct .. AJAX can only display what is updated in clientraw.txt.  The 'natural' way to update the PHP is to put a
Code: [Select]
<meta http-equiv="Refresh" content="300" /> to have the browser reload the page at the same interval as your testtags.php is updated by WD .. 300sec=5minutes=my interval for upload to testtags.php :)

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline pablo

  • Member
  • *
  • Posts: 32
Okay, I was thinking of that HTML directive as my ace-in-the-hole.  heh heh!  Thanks a lot Ken.