Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Auto-refresh Website Index Page Without Using Meta Refresh

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

Moderators: daj, TNETWeather

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

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

Postby elmdcw » Fri Sep 16, 2011 8:53 pm

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: 5148
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Postby mcrossley » Sat Sep 17, 2011 2:00 pm

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 Jan 12, 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

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

Postby elmdcw » Sun Sep 18, 2011 9:13 pm

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: 5148
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Postby mcrossley » Mon Sep 19, 2011 10:45 am

It seems to be working now Dave?

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

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

Postby elmdcw » Mon Sep 19, 2011 7:35 pm

Yep. I missed a bracket! Thanks

Dave

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

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

Postby saratogaWX » Mon Sep 19, 2011 8:04 pm

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 Jan 12, 2011 9:45 am
Weather Station: VP2
Operating System: W7
Location: Ruislip

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

Postby elmdcw » Wed Sep 21, 2011 11:30 am

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 May 23, 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

Postby dezzeer » Mon Jan 09, 2012 2:30 pm

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

many thanks Darron

Synewave
Posts: 642
Joined: Mon Jan 25, 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

Postby Synewave » Mon Jan 09, 2012 8:27 pm

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 May 23, 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

Postby dezzeer » Fri Jan 13, 2012 9:01 am

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 Nov 15, 2011 3:31 am
Weather Station: Davis
Operating System: XP
Location: Nevada

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

Postby vegasmini » Mon Apr 16, 2012 7:39 pm

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.

User avatar
Mapantz
Posts: 547
Joined: Sat Dec 17, 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64 - A beast.
Location: Wareham, Dorset - UK
Contact:

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

Postby Mapantz » Fri May 11, 2012 11:37 am

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
Image

User avatar
PeterP
Posts: 80
Joined: Tue Apr 21, 2009 4:03 am
Weather Station: Davis VP2
Operating System: Vista
Location: Coromandel, New Zealand
Contact:

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

Postby PeterP » Mon May 14, 2012 5:47 pm

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: 26517
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

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

Postby steve » Mon May 14, 2012 6:05 pm

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
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Please read the posts in the Announcements section about the current status of Cumulus development since I have retired from my day job

aduncan
Posts: 43
Joined: Tue Apr 10, 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

Postby aduncan » Mon May 14, 2012 7:56 pm

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


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 4 guests