Hi, I'm pretty new to cumulus so please excuse My limited knowledge.
I've created my website and added the realtime script to it. The tags are updated fine except for duplicates eg i have current temp at the top and lower down the page, the top one works, but the bottom one doesn't. I took the span tags out of the lower readings as no reading showed.
Also, is it possible to refresh the icon tags using realtime eg wind direction?
http://www.nantwich-weather.co.uk/
Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Realtime images
Moderator: daj
- steve
- Cumulus Author
- Posts: 26672
- Joined: Mon 02 Jun 2008 6:49 pm
- Weather Station: None
- Operating System: None
- Location: Vienne, France
- Contact:
Re: Realtime images
I had a quick look at your site, but I soon realised that I don't understand anything about how it's supposed to work, so can't offer any help, I'm afraid. Hopefully one of the web boffins here will be able to help. I couldn't actually see any problems anyway, it all looked good to me.
Steve
- GraemeT
- Posts: 312
- Joined: Wed 21 Oct 2009 11:19 am
- Weather Station: La Crosse WS-2355 & WS-2306
- Operating System: Windoze 7, 10, 11
- Location: Bayswater, Australia
- Contact:
Re: Realtime images
Hi marfanuk,
I think you'll find the 'id' anchor can be only used once in a page.
For example, if you want to use the "temp" id again within the same page, you would have to supply a new value for the "id=temp" attribute....for example, you might use the equivalent RCwebtag value, as below:
I use the method above to display a set of current conditions in the top right corner of some of my pages: http://weather.gktnet.com/today-yesterday.php
Alternatively, you can define your own id values by adding definitions to either cumuluswebtags.php or cumulus.xml
For example, you can do this in cumuluswebtags.php:You'll then have 2 temp values you can use as id's inside your spans, although I'm sure there are less 'messy' ways of doing it.
More information can be found here: http://www.w3schools.com/tags/att_global_id.asp
I hope this is useful.
I think you'll find the 'id' anchor can be only used once in a page.
For example, if you want to use the "temp" id again within the same page, you would have to supply a new value for the "id=temp" attribute.
Code: Select all
<tr class="td_temperature_data">
<td width="120" height="58" bgcolor="#EAEAEA"><center><h2><span id="temp"></span> °C</h2></center></td>
</tr>Code: Select all
<tr class="td_temperature_data">
<td width="120" height="58" bgcolor="#EAEAEA"><center><h2><span id="RCtemp"></span> °C</h2></center></td>
</tr>Alternatively, you can define your own id values by adding definitions to either cumuluswebtags.php or cumulus.xml
For example, you can do this in cumuluswebtags.php:
Code: Select all
...code..
$temp = '<#temp>'; // The outside temperature
$temp2 = '<#temp>'; // The outside temperature
...code...
More information can be found here: http://www.w3schools.com/tags/att_global_id.asp
I hope this is useful.
Cheers,
Graeme.
Graeme.
- mcrossley
- Posts: 14388
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Realtime images
For 'duplicted' values it is better to use a class value rather than the id, I use that for the temp unit spans etc on my Ajax updated pages.although I'm sure there are less 'messy' ways of doing it
- GraemeT
- Posts: 312
- Joined: Wed 21 Oct 2009 11:19 am
- Weather Station: La Crosse WS-2355 & WS-2306
- Operating System: Windoze 7, 10, 11
- Location: Bayswater, Australia
- Contact:
Re: Realtime images
Yes, good point Mark.
I'll just add that yes, most of my webpages are in need of updating/cleaning up/re-writing....
I'll just add that yes, most of my webpages are in need of updating/cleaning up/re-writing....
Cheers,
Graeme.
Graeme.
- marfanuk
- Posts: 43
- Joined: Wed 06 Nov 2013 5:27 pm
- Weather Station: Davis Vantage Vue
- Operating System: Raspbian on the Raspberry Pi 2
- Location: Nantwich, United Kingdom
- Contact:
Re: Realtime images
Thanks Guys for the help. I shall have a bash at it today.
I presume its not possible to update the images using <span> and realtime?
I presume its not possible to update the images using <span> and realtime?
- mcrossley
- Posts: 14388
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: Realtime images
Some example code using JQuery that updates spans based on either id or className being the same as the Cumulus webtag name (All the web tag values are stored in the 'cumulusTags' object in this example)...mcrossley wrote:For 'duplicated' values it is better to use a class value rather than the id, I use that for the temp unit spans etc on my Ajax updated pages.
Code: Select all
//get all the spans on the page and update them if we have data
$("span").each(function () {
//get the span 'id', or if it is not present the 'className'
id = this.id ? this.id : this.className;
val = cumulusTags[id]; //get the cumulus value
if (val !== undefined) { //do we have a cumulus value for this field?
this.innerHTML = val; //set the field text
}
};
Not sure what you mean by 'images', the realtime.txt file only contains some limited data?marfanuk wrote:I presume its not possible to update the images using <span> and realtime?