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

User avatar
nitrx
Posts: 1308
Joined: Sun Dec 13, 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

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

Postby nitrx » Mon May 14, 2012 8:08 pm

aduncan wrote: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


The data provided by the realtime.txt are updated every x seconds by the ajax-script but the image wil only be update after the minutes you've set interval by updating the page by cumulus there is no data in the realtime.txt for updating your image, by using F5 or CTRL-reload. The only way to keep realtime images of your webcam in your page is to upload an image in the same interval as your realtime.txt is updated or to incude a realime livestream from a webcam (will cost you a heavy load of bandwith !) Or use the same tag as on your webcam page ? <img src="http://www.btinternet.com/~helicop/DCS-932L.jpg" id="reloader" onload="setTimeout('document.getElementById(\'reloader\').src=\'DCS-932L.jpg?\'+new Date().getMilliseconds()', 10000)" />
Last edited by nitrx on Mon May 14, 2012 8:10 pm, edited 1 time in total.

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 May 14, 2012 8:09 pm

You can use Javascript to refresh your image very easily.

Put this between your <head> </head>:

Code: Select all

<script type="text/javascript"> //Auto refresh image
function refreshIt() {
  if (!document.images) return;
  document.images['webcam'].src ='/webcam/webcam001.jpg?' +
Math.random();
  setTimeout('refreshIt()',30000); // refresh every 30 seconds
}
</script>


Change <body> to this:

Code: Select all

<body onload="setTimeout('refreshIt()',30000)">


Your image in your body section will look like this:

Code: Select all

<img id="webcam" src="/webcam/webcam001.jpg" alt="webcam" width="320" height="240" />


Once your page loads, the image will refresh every 30 seconds.

My page shows an example of if if you want to check it out.
http://mtcharlestonweather.com

-John

User avatar
steve
Cumulus Author
Posts: 26629
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 8:16 pm

aduncan wrote: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.

You'll need to add some code to reload the image, and use a 'cache buster' of the date and time. See the standard graphs page for an example:

Code: Select all

function changeImage(im) {
   document.images["graphs"].src = im + "?" + new Date().getTime();
}


Call that function when the data changes, and for the 'im' parameter, use the URL of the image.
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 9:05 pm

Thanks nitrx, I'd already tried that, but when it refreshed it blanked. But when I changed the second file name in that line to a full http://...etc, it worked perfectly. The question is why did it work as a seperate web page? No - don't baffle me with science - I don't have time to learn website coding, got enough hobbies already. The weather station was just to see mainly what conditions are like to go and fly my model aircraft, THAT'S where all my money and time go.

Andrew

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 » Tue May 15, 2012 1:21 am

Thanks Steve.

I did notice a few gaps in my April and May logs, and my dayfile stops at 20/04/12, but strangly the Dayfile editor was complete,and otherwise Cumulus was working as it should. Obviously (even to me) this shouldnt have been so.

I did mess around with the Pc around then, installing a ssd for windows as c:/ drive,, and moving programs to D:/ drive and Users to a E:/ drive.

To cut a long story short, I had 2 installations of Cumulus, and silly me had been editing in one place and running the other...... :oops:

All sorted now,

Thanks for your patience with novices like me.

rocketfingers
Posts: 21
Joined: Thu Jan 03, 2013 8:47 pm
Weather Station: Easy Weather WH1080
Operating System: Win 7 Ultimate, SP1
Location: Telford, Shropshire, UK
Contact:

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

Postby rocketfingers » Sun Jan 13, 2013 7:36 pm

I have followed the instructions above and also replaced the indexT.htm with the data supplied by synewave, my intro page is fine and updates every minute but my guages page has stopped updating at all.
I've zipped the indexT file if anybody wishes to have a look.
Getting a great deal of help from you guys.
Many thanks
John
You do not have the required permissions to view the files attached to this post.

water01
Posts: 1461
Joined: Sat Aug 13, 2011 9:33 am
Weather Station: WH1081
Operating System: Windows 7 64bit HP SP1
Location: Somewhere in the USA
Contact:

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

Postby water01 » Sun Jan 13, 2013 7:53 pm

I believe the problem is you have put jquery.js in your cumulus home directory and the gauges uses j-query-1.8.2.min.js in the script directory installed with the gauges. Your load takes precedence and therefore gauges do not work.

I would try changing

Code: Select all

<script src="jquery.js" type="text/javascript"></script>


to

Code: Select all

<script src="scripts/jquery-1.8.2.min.js" type="text/javascript"></script>


and I think that will cure the problem

Or leave

Code: Select all

<script src="jquery.js" type="text/javascript"></script>


and make sure that

Code: Select all

<script src="scripts/jquery-1.8.2.min.js"></script>


in gauges-ssT.htm

is commented out so it uses your already loaded jquery.js.

rocketfingers
Posts: 21
Joined: Thu Jan 03, 2013 8:47 pm
Weather Station: Easy Weather WH1080
Operating System: Win 7 Ultimate, SP1
Location: Telford, Shropshire, UK
Contact:

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

Postby rocketfingers » Sun Jan 13, 2013 10:48 pm

I don't have scripts/jquery-1.8.2.min.js in my folder, only jquery.js, which is what I downloaded from synewaves page.
John

rocketfingers
Posts: 21
Joined: Thu Jan 03, 2013 8:47 pm
Weather Station: Easy Weather WH1080
Operating System: Win 7 Ultimate, SP1
Location: Telford, Shropshire, UK
Contact:

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

Postby rocketfingers » Mon Jan 14, 2013 9:16 am

I have found jquery-1.8.2.min.js on the microsoft website and placed it in the web folder but the gauges still dont refresh unless I click the refresh on explorer.
John

water01
Posts: 1461
Joined: Sat Aug 13, 2011 9:33 am
Weather Station: WH1081
Operating System: Windows 7 64bit HP SP1
Location: Somewhere in the USA
Contact:

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

Postby water01 » Mon Jan 14, 2013 11:47 am

Any chance of a link to your website so we can see what is going on?

rocketfingers
Posts: 21
Joined: Thu Jan 03, 2013 8:47 pm
Weather Station: Easy Weather WH1080
Operating System: Win 7 Ultimate, SP1
Location: Telford, Shropshire, UK
Contact:

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

Postby rocketfingers » Mon Jan 14, 2013 12:51 pm


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 14, 2013 4:40 pm

Firstly, your weatherstyle.css is missing.
Also the index page you have published there does not have the changes required for the auto-refresh to work. I guess you have not disabled Cumulus from uploading the standard files?

rocketfingers
Posts: 21
Joined: Thu Jan 03, 2013 8:47 pm
Weather Station: Easy Weather WH1080
Operating System: Win 7 Ultimate, SP1
Location: Telford, Shropshire, UK
Contact:

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

Postby rocketfingers » Mon Jan 14, 2013 7:20 pm

Sorry, I should have sent a post to say that I deleted cumulus and started again with the default files and all I have done is edited the indexT.htm <head>.
I am making a fresh start as I think it is probably the best way forward.
Can you tell me which files I need to download/alter to achieve auto update as it should be.
Regards
John

loades
Posts: 5
Joined: Tue Feb 05, 2013 10:50 am
Weather Station: WH1080
Operating System: XP
Location: Southampton

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

Postby loades » Tue Feb 05, 2013 11:12 am

Probably a dumb question but I can't get anywhere without asking it! The first posting in this thread says "Implementation is simple, just unzip this file and upload the realtimereader.js and jquery.js files to your webserver". Below that it says "Attachment:
jquery and realtimereader.zip". There is no active link in any of this text. At the bottom of the posting it says in red "You do not have the required permissions to view the files attached to this post.

How do I get permission to download the required zip file?

Thanks

Malcolm

User avatar
steve
Cumulus Author
Posts: 26629
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 » Tue Feb 05, 2013 11:26 am

Unregistered and 'new' users can't download files from the forum. Now that your first post has been approved, you should be able to download the attachments.
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


Return to “Web site - General”

Who is online

Users browsing this forum: No registered users and 2 guests