Page 3 of 8

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Fri 16 Sep 2011 8:53 pm
by elmdcw
mcrossley wrote:
TgT wrote:Good script :clap:

What about some flashcolor for changed data? :oops:
I have done that on my 'now' page. You need to store all the values, then on the next refresh compare new with old. If different set a 'newValue' style to change the colour. Then at the end of the update routine overwrite the 'old' values with the new and set a 'setTimout()' to call another function after say 10 seconds the clears the new value styles.

--sent from my phone
Hi Mark,
Brilliant ! That's exactly what I was looking to do. Is this all done via js? or does it need PHP or anything else?

Dave
http://www.weather.btinternet.co.uk/

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Sat 17 Sep 2011 2:00 pm
by mcrossley
Well my version is all in client-side JavaScript. Pretty straightforward stuff, have a look at the code and copy/adapt it to your needs.

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Sun 18 Sep 2011 9:13 pm
by elmdcw
Hi,

I noticed that daj had done something similar so checked that out and got it working.
See http://www.weather.btinternet.co.uk/tes ... altime.htm
The only problem is that the refresh doesn't work in IE9, not even in comptibility mode. Chrome is fine.
Anyone got any ideas?
Cheers
Dave
http://www.weather.btinternet.co.uk

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 19 Sep 2011 10:45 am
by mcrossley
It seems to be working now Dave?

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 19 Sep 2011 7:35 pm
by elmdcw
Yep. I missed a bracket! Thanks

Dave

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 19 Sep 2011 8:04 pm
by saratogaWX
There is already an AJAX script for updates using Cumulus realtime.txt that you could use. It would just require you to add HTML markup like

Code: Select all

<span class="ajax" id="ajax....."></span>
around the values on the page to be updated.

The ajaxCUwx.js script is part of the PHP/AJAX template set, but works equally well standalone :)

The script was originally developed for Weather-Display, and has been ported to multiple weather software use.

http://saratoga-weather.org/wxtemplates ... jaxCUwx.js

Best regards,
Ken

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Wed 21 Sep 2011 11:30 am
by elmdcw
I had originally assumed that the stuff on there was just for PHP, but there is plenty of good js stuff too. Thanks for the tip off. I have a bit of reading and testing to do :-)

Dave

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 09 Jan 2012 2:30 pm
by dezzeer
hi all do you know if this auto refresh works for newer versions of cumulus.

many thanks Darron

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 09 Jan 2012 8:27 pm
by Synewave
The code is for your website and is therefore not related to versions of Cumulus.

In short, yes it will work.

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Fri 13 Jan 2012 9:01 am
by dezzeer
hi was wondering if i just re did the code in index t for since midnight and last 24hrs would it auto refresh them as well are do i need to be doing other things.
regards Darron

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 16 Apr 2012 7:39 pm
by vegasmini
I was wondering if anyone be able to help me add some code to the realtimereader.js script?
I would like it to check the last time the page was updated (using <span id="time"></span>) and then display some images and then redirect to a new page if the realtime.txt file hasn't been updated in 30-40 seconds.

Let me explain:
When loading the page it will dispaly "Update status = green led image"
If the realtime.txt doesn't get updated after 20 seconds it will dispaly a yellow led,
10 more seconds of no update it will display a red led,
If 10 more seconds go by without an update it will go to a page stating that the site is temporarily down (maintenance page).

This is some script I was able to come up with so far, but I do not know the code needed to check after the first 10 seconds:
Removed from my realtimereader.js file

Code: Select all

if (first_run==false) {

//check if time has changed. If so, display leds
var check1 = time;
if (check1!=$("time").text()) {var imagen = "greenled.png";}
if (check1==$("#time").text()){window.open('/error/maintenance.php','_self');}
$("#check1").html('<img src="/images/'+imagen+'"align =absmiddle>');

}

Thanks for your help.

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Fri 11 May 2012 11:37 am
by Mapantz
By using the method that the OP has made, would my index page still get processed and uploaded by Cumulus at the 15 minute interval i've set it at?

Regards.

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 14 May 2012 5:47 pm
by PeterP
Hi folks,

I am using the standard templates, and have added this update code including the "updating in xx seconds" to my indexT file, but the website still displays the standard files?

Any clues as to what the problem is would be appreciated. I was previously unable to add a flagcounter for the same reason.

I dont know if it is significant but the dates on the index and indexT files show differently. Should they not be updated at the same time? I thought cumulus processes indexT, then transfers the file to index, which is ftp'd?
Program Manager_2012-05-15_05-30-38.png
]
DCumuluswebindexT.png
Many thanks,
Peter

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 14 May 2012 6:05 pm
by steve
It looks to me like you're not actually using the templates in that folder, and it's been that way since 26th March, which is the last time Cumulus processed the files there. You'll have to show me what your Cumulus internet settings are.

Re: Auto-refresh Website Index Page Without Using Meta Refre

Posted: Mon 14 May 2012 7:56 pm
by aduncan
I've applied the op's code and got the data updating every 60 seconds, thanks for that.

Now I'm trying to be clever (for me!). I've set Yawcam to send a .jpg file to my cumulus\web folder every 60 seconds, and added the file to the extra files section in the internet config pages. The file is ftp'd ok. I've added the image to the bottom of my web page, and when I open the page there it is.

But after the realtime files are applied and the data changes, the image does not unless I F5 or reload the page. I've tried umpteen code snippets from googling, but nothing works.

Could someone point me in the right direction, I know next to nothing about web design, although I've been in IT for years.

Andrew