Page 1 of 1
Realtime images
Posted: Thu 21 Nov 2013 3:48 pm
by marfanuk
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/
Re: Realtime images
Posted: Thu 21 Nov 2013 4:14 pm
by steve
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.
Re: Realtime images
Posted: Thu 21 Nov 2013 10:54 pm
by GraemeT
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.
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>
...for example, you might use the equivalent RCwebtag value, as below:
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>
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:
Code: Select all
...code..
$temp = '<#temp>'; // The outside temperature
$temp2 = '<#temp>'; // The outside temperature
...code...
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.
Re: Realtime images
Posted: Thu 21 Nov 2013 11:17 pm
by mcrossley
although I'm sure there are less 'messy' ways of doing it
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.
Re: Realtime images
Posted: Thu 21 Nov 2013 11:27 pm
by GraemeT
Yes, good point Mark.
I'll just add that yes, most of my webpages are in need of updating/cleaning up/re-writing....
Re: Realtime images
Posted: Fri 22 Nov 2013 8:27 am
by marfanuk
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?
Re: Realtime images
Posted: Sun 24 Nov 2013 1:47 pm
by mcrossley
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.
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)...
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
}
};
marfanuk wrote:I presume its not possible to update the images using <span> and realtime?
Not sure what you mean by 'images', the realtime.txt file only contains some limited data?