Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Auto-refresh Website Index Page Without Using Meta Refresh

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

elmdcw
Posts: 21
Joined: Wed 12 Jan 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

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

Post 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/
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Post 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.
elmdcw
Posts: 21
Joined: Wed 12 Jan 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

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

Post 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
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Post by mcrossley »

It seems to be working now Dave?
elmdcw
Posts: 21
Joined: Wed 12 Jan 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

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

Post by elmdcw »

Yep. I missed a bracket! Thanks

Dave
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

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

Post 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
elmdcw
Posts: 21
Joined: Wed 12 Jan 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

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

Post 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
dezzeer
Posts: 35
Joined: Mon 23 May 2011 6:10 am
Weather Station: vantage pro2
Operating System: windows xp
Location: bb2 5jf

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

Post by dezzeer »

hi all do you know if this auto refresh works for newer versions of cumulus.

many thanks Darron
Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

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

Post by Synewave »

The code is for your website and is therefore not related to versions of Cumulus.

In short, yes it will work.
dezzeer
Posts: 35
Joined: Mon 23 May 2011 6:10 am
Weather Station: vantage pro2
Operating System: windows xp
Location: bb2 5jf

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

Post 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
vegasmini
Posts: 2
Joined: Tue 15 Nov 2011 3:31 am
Weather Station: Davis
Operating System: XP
Location: Nevada

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

Post 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.
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

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

Post 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.
Image
PeterP

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

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

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

Post 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.
Steve
aduncan
Posts: 46
Joined: Tue 10 Apr 2012 1:18 pm
Weather Station: Weathereye WEA22
Operating System: Win7
Location: Drumclog, South Lanarkshire

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

Post 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
Post Reply