Page 2 of 3
Re: Web tag parameters
Posted: Tue 21 Dec 2010 6:30 pm
by steve
It should do, yes. Except that I seem to have forgotten to include those. Next build!
By the way, you should really put plain text in single quotes to stop it being interpreted, or you may get unexpected results.
<#TtempH format="'à' hh:nn 'le' dd mmmm yyyy">
Re: Web tag parameters
Posted: Tue 21 Dec 2010 10:02 pm
by laulau
Thanks Steve,
It's ok with last build
I think with b970 99.9% of Cumulus is customizable, nice job

Re: Web tag parameters
Posted: Tue 08 Feb 2011 1:29 pm
by elmdcw
Anyone know if the <#LastRainTipISO format="hh:mm on dd mmm yyyy"> webtag can be used to show how many days since last rain? Or would that require a webtag all of its own?
Re: Web tag parameters
Posted: Tue 08 Feb 2011 1:33 pm
by steve
elmdcw wrote:Anyone know if the <#LastRainTipISO format="hh:mm on dd mmm yyyy"> webtag can be used to show how many days since last rain? Or would that require a webtag all of its own?
I think that as it stands you would have to use some sort of script to work out the difference between the last tip date and the current date.
I do intend to implement 'days since last rain' etc at some point.
Re: Web tag parameters
Posted: Tue 08 Feb 2011 1:36 pm
by nitrx
elmdcw wrote:Anyone know if the <#LastRainTipISO format="hh:mm on dd mmm yyyy"> webtag can be used to show how many days since last rain? Or would that require a webtag all of its own?
Last rain registration <#LastRainTipISO format="'at' hh:nn 'on' dd mmmm yyyy">
Works only with Cumulus 1.9.1 and above
*edit* look for parameters in the help it doesn't give the days ofcourse (crossposted with Steve)
Re: Web tag parameters
Posted: Tue 08 Feb 2011 1:42 pm
by mcrossley
This is how I do it, perhaps not the most efficient way...
Code: Select all
var str = cumulus.LastRainTipISO.split(" ");
var dt = str[0].split("-");
var tm = str[1].split(":");
var today = new Date();
var then = new Date();
var thenPlus1 = new Date();
today.setHours(0,0,0,0);
then.setFullYear(dt[0],dt[1]-1,dt[2]);
then.setHours(tm[0],tm[1],0,0);
thenPlus1.setTime(then.getTime() + 86400000);
if (then.getTime() >= today.getTime()) {
cumulus.LastRainTipISO = "Today at "+str[1];
} else if (thenPlus1.getTime() >= today.getTime()) {
cumulus.LastRainTipISO = "Yesterday at "+str[1];
} else {
cumulus.LastRainTipISO = "" + then.getDate() + " " + months[then.getMonth()] + " at " + str[1];
}
Re: Web tag parameters
Posted: Wed 09 Feb 2011 12:44 pm
by MickinMoulden
steve wrote:I do intend to implement 'days since last rain' etc at some point.
That's a great idea Steve, great for the records page! .......oooh, how about 'most days straight of rain', just worded better than what I just put though

Re: Web tag parameters
Posted: Wed 02 Mar 2011 11:40 pm
by RayProudfoot
steve wrote:Yes, but again, the whole parameter value would need to be in double quotes as it contains spaces:
<#LastRainTipISO format="hh:mm on dd mmm yyyy">
Steve,
I've just found this thread and after pasting your example into my IndexT.html document DreamWeaver showed the following message after validation...
Quotation mark found between tags, HTML documents should not contain these values. Consider using " instead
I tried inserting " but the result was garbled text. If you visit my website you'll see the time and date is now correctly formatted but DW doesn't like quotes. Is there a way to keep DW happy?
Re: Web tag parameters
Posted: Wed 02 Mar 2011 11:47 pm
by nitrx
RayProudfoot wrote:steve wrote:Yes, but again, the whole parameter value would need to be in double quotes as it contains spaces:
<#LastRainTipISO format="hh:mm on dd mmm yyyy">
Steve,
I've just found this thread and after pasting your example into my IndexT.html document DreamWeaver showed the following message after validation...
Quotation mark found between tags, HTML documents should not contain these values. Consider using " instead
I tried inserting " but the result was garbled text. If you visit my website you'll see the time and date is now correctly formatted but DW doesn't like quotes. Is there a way to keep DW happy?
Dreamweaver is dreaming <#lastRainTipISO isn't html eather the ducument must be proccessed by cumulus to make a valid html document the file on the local disk could als end on .txt and processed by cumulus and afer that uploaded as a htm file, you should consider to use notepad or notepad+ to edit the files.
Re: Web tag parameters
Posted: Thu 03 Mar 2011 8:20 am
by steve
RayProudfoot wrote:Is there a way to keep DW happy?
Ron's correct. The only way to keep DW happy would be if you could tell it that the Cumulus web tags aren't HTML and that it should mind its own business. It's a similar problem to the angle brackets being converted to 'ampersand entities'.
Re: Web tag parameters
Posted: Thu 03 Mar 2011 5:33 pm
by RayProudfoot
Ron / Steve,
Many thanks. Not the answer I wanted to read but I accept it's due to DreamWeaver's limitations.
Using NotePad+ is not desirable as I can't see the immediate results of my changes which as a beginner I need. I'll try to ignore the warnings.
Re: Web tag parameters
Posted: Thu 03 Mar 2011 5:48 pm
by Gina
Try Kompozer.
Re: Web tag parameters
Posted: Thu 03 Mar 2011 6:34 pm
by RayProudfoot
Gina wrote:Try Kompozer.
Gina, I've paid for Dreamweaver and want to learn how to create webpages with it. I appreciate it's complex but I'm a good learner.
LATER: There's an option under Validation to switch off
Quotes in Text. That's supressed the warnings.
Re: Web tag parameters
Posted: Fri 04 Mar 2011 2:45 pm
by nking
mcrossley wrote:This is how I do it, perhaps not the most efficient way...
Code: Select all
var str = cumulus.LastRainTipISO.split(" ");
var dt = str[0].split("-");
var tm = str[1].split(":");
var today = new Date();
var then = new Date();
var thenPlus1 = new Date();
today.setHours(0,0,0,0);
then.setFullYear(dt[0],dt[1]-1,dt[2]);
then.setHours(tm[0],tm[1],0,0);
thenPlus1.setTime(then.getTime() + 86400000);
if (then.getTime() >= today.getTime()) {
cumulus.LastRainTipISO = "Today at "+str[1];
} else if (thenPlus1.getTime() >= today.getTime()) {
cumulus.LastRainTipISO = "Yesterday at "+str[1];
} else {
cumulus.LastRainTipISO = "" + then.getDate() + " " + months[then.getMonth()] + " at " + str[1];
}
Hi Mark,
Probably a stupid question for some but how does one use the above code within the website html?
I hope I'm not the only one not knowing the answer
Thanks
Re: Web tag parameters
Posted: Fri 04 Mar 2011 3:00 pm
by mcrossley
Neil
It assumes you have a page that is being updated via a client side script from the realtime.txt file.
I parse the realtime.txt into an object called 'cumulus' with the property names corresponding to the web tag names.
[actually I don't but that lets leave that for now!]
The page HTML then has <span>'s for the variables,
Code: Select all
...
Last rained <span id="LastRainTipISO"></span>
...
and the script sets the span_name.innerHTML to be the value of the corresponding cumulus.tag_name value. I do this in a loop so I don't have to change the script every time I add or remove a data field (span) from the HTML. But my code does involve using the hated eval() function

Code: Select all
...
//get all the spans on the page
var spans = document.getElementsByTagName("span");
//loop through the spans to update them
for(var i=0; i<spans.length; i++){
var id = spans[i].id;
eval("var val=cumulus."+id+";"); //get the cumulus value
if(val != null){ //do we have a cumulus value for this field?
eval("var last=lastVals."+id+";"); //do we have a lastVal?
spans[i].innerHTML = val; //set the field text
}
}
...
Hmm, that's probably as clear as mud!