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

Web tag parameters

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

Moderator: daj

User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Web tag parameters

Post 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">
Steve
User avatar
laulau
Posts: 678
Joined: Tue 13 Oct 2009 10:52 pm
Weather Station: WeatherDuino Pro2
Operating System: Win 7
Location: Meyenheim, Alsace, FR
Contact:

Re: Web tag parameters

Post by laulau »

Thanks Steve,

It's ok with last build ;)
I think with b970 99.9% of Cumulus is customizable, nice job :clap: :clap: :clap:
Laurent

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

Re: Web tag parameters

Post 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?
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Web tag parameters

Post 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.
Steve
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Web tag parameters

Post 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)
User avatar
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: Web tag parameters

Post 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];
			}
Last edited by mcrossley on Thu 03 Mar 2011 8:39 am, edited 1 time in total.
User avatar
MickinMoulden
Posts: 499
Joined: Mon 20 Dec 2010 12:12 pm
Weather Station: WS-1081 with rain gauge mod
Operating System: Windows 7 & 1.9.3 b1059
Location: Palmerston, NT, Australia
Contact:

Re: Web tag parameters

Post 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 :D
Michael, Palmerston, NT Australia www.Palmerston-WeatherImageNo image? I'm offline!
ImageImage
RayProudfoot
Posts: 3602
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Web tag parameters

Post 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?
Cheers,
Ray, Cheshire.

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

Re: Web tag parameters

Post 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.
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Web tag parameters

Post 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'.
Steve
RayProudfoot
Posts: 3602
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Web tag parameters

Post 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.
Cheers,
Ray, Cheshire.

Image
Gina
Posts: 1885
Joined: Sat 21 Feb 2009 12:41 pm
Weather Station: Nothing working ATM - making one
Operating System: OS X, Linux Mint, Win7 & XP
Location: Devon UK

Re: Web tag parameters

Post by Gina »

Try Kompozer.
Gina

Sorry, no banner - weather station out of action. Hoping to be up and running with a new home-made one soon.
RayProudfoot
Posts: 3602
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: Web tag parameters

Post 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.
Cheers,
Ray, Cheshire.

Image
User avatar
nking
Posts: 813
Joined: Thu 17 Dec 2009 2:03 pm
Weather Station: W-8681
Operating System: Windows 10
Location: Hurstpierpoint, West Sussex, UK
Contact:

Re: Web tag parameters

Post 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
User avatar
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: Web tag parameters

Post 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!
Post Reply