Sandaysoft

Support forum for Cumulus weather station software
It is currently Tue May 21, 2013 8:37 am
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 69 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 4:49 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17562
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
Quote:
I want to split the date into multiple parts and place them in different cells.

What you could do is create three arrays for the components of the timestamps:

var hightempY = new Array("<#ByMonthTempHT mon=1 format=yyyy>", ...
var hightempD = new Array("<#ByMonthTempHT mon=1 format="'Day 'd">", ...
var hightempT = new Array("<#ByMonthTempHT mon=1 format=hh:nn>", ...

and then when you create your cells, give them IDs of (say) TempHY, TempHD, TempHT, and change the code in the changeData function to change all three fields, i.e

document.getElementById('TempHY').innerHTML = hightempY[month];
document.getElementById('TempHD').innerHTML = hightempD[month];
document.getElementById('TempHT').innerHTML = hightempT[month];

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 5:01 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 1708
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Thanks Steve. I'm pleased it's possible. I shall need to read your suggestion a few times so it sinks in. :lol:

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 6:42 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 1708
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Steve,

I'm having problems with the day number element. I've used your code as a guide but there is a syntax error in this I can't resolve.

var hightempD = new Array("<#ByMonthTempHT mon=1 format="'Day 'd">","<#ByMonthTempHT mon=2 format="'Day 'd">","<#ByMonthTempHT mon=3 format="'Day 'd">","<#ByMonthTempHT mon=4 format="'Day 'd">","<#ByMonthTempHT mon=5 format="'Day 'd">","<#ByMonthTempHT mon=6 format="'Day 'd">","<#ByMonthTempHT mon=7 format="'Day 'd">","<#ByMonthTempHT mon=8 format="'Day 'd">","<#ByMonthTempHT mon=9 format="'Day 'd">","<#ByMonthTempHT mon=10 format="'Day 'd">","<#ByMonthTempHT mon=11 format="'Day 'd">","<#ByMonthTempHT mon=12 format="'Day 'd">");

Can you spot the error?

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 6:46 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17562
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
RayProudfoot wrote:
new Array("<#ByMonthTempHT mon=1 format="'Day 'd">",

Yes; the first double quote for the format parameter will be taken as the termination of the array item. I don't know enough about using quotes in javascript to know how you get around that, particularly as single quotes are also used inside the format parameters. In some languages, if you want a double quote inside a string, you put two double quotes, e.g:

new Array("<#ByMonthTempHT mon=1 format=""'Day 'd"">"

but I don't know if that works in javascript. It may be that you have to 'escape' the quote character somehow, maybe with a backslash...

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 6:53 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 1708
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
This doesn't cause a syntax error.

var hightempD = new Array("<#ByMonthTempHT mon=1 format='Day 'd>","<#ByMonthTempHT mon=2 format='Day 'd>","<#ByMonthTempHT mon=3 format='Day 'd>","<#ByMonthTempHT mon=4 format='Day 'd>","<#ByMonthTempHT mon=5 format='Day 'd>","<#ByMonthTempHT mon=6 format='Day 'd>","<#ByMonthTempHT mon=7 format='Day 'd>","<#ByMonthTempHT mon=8 format='Day 'd>","<#ByMonthTempHT mon=9 format='Day 'd>","<#ByMonthTempHT mon=10 format='Day 'd>","<#ByMonthTempHT mon=11 format='Day 'd>","<#ByMonthTempHT mon=12 format='Day 'd>")

I removed the double quotes after format= and between d and >. Not sure if that will work but at least it doesn't cause an error.

I'll battle on. Thanks for your answer. Quotes and where to put them is always a bit of a nightmare isn't it? :?

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 7:46 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 1708
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
I've made progress. I decided to dump the Day = bit as double-quotes didn't work either. Instead I've named the columns so it's clear what is what.
Attachment:
NewMonthlyRecord.jpg

I've only changed Highest Temperature at the moment just so I can see if it works.

I have two queries.

1) If I use the format in the data array to define how I want each element of the date to appear is it necessary to use format again in each td element? I can't think why it would so I haven't included it.

2) When I first load the page I'm still seeing the old date and time format but after hitting a month button it then shows each element of the date and time correctly in its own cell. Why do I still see the original date/time on first load?

Other than that it looks like I have the basics working.


You do not have the required permissions to view the files attached to this post.

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 7:48 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2512
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Here is a slight variation on Steve's default page. I've just amended the date/time format slightly, and made it so that the current month is always displayed on entering the page.

You can view my data here: http://weather.wilmslowastro.com/monthlyrecord.htm

Note the navigation menu is wrong for my site (it is the default) and I had to zip the file below as you cannot attach html or txt files.

EDIT: File removed see later posts for an updated version

_________________
Mark
Wilmslow Astro Weather


Last edited by mcrossley on Thu Apr 12, 2012 9:14 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 7:53 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17562
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
RayProudfoot wrote:
1) If I use the format in the data array to define how I want each element of the date to appear is it necessary to use format again in each td element? I can't think why it would so I haven't included it.

2) When I first load the page I'm still seeing the old date and time format but after hitting a month button it then shows each element of the date and time correctly in its own cell. Why do I still see the original date/time on first load?

You've answered your own question. The reason you have to do (1) is because of (2). Unless you add some javascript that triggers when the page is loaded. I'm not completely sure how you do that, possibly by changing the <body> tag to:

<body onload="changeData(0);">

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 7:54 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17562
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
mcrossley wrote:
and made it so that the current month is always displayed on entering the page.
I was going to suggest that in my previous post, but my javascript knowledge is already being stretched :lol:

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 8:03 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17562
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
Mark, why does:

"<#ByMonthDailyRainHT mon=1 format="'day' dd, yyyy 'at' hh:mm">"

work in your code but apparently didn't for Ray? Why doesn't the double quote starting the format terminate the array item?

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 8:10 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2512
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Err, because they won't be there when the JavaScript runs?! After preprocessing by Cumulus there will just be the string.

PS: I just noticed that the Rain date/times are a bit iffy, new version on the way...

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 8:11 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 1708
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Hi chaps,

Success! I used Mark's function to show the current month. That's got rid of the old date format appearing. Thanks Mark!

But when I loaded his htm file in Dreamweaver 4 it also highlighted the same section as containing a syntax error. Maybe it's how I have my DW Validation settings as I currently get loads of warnings and errors when validating with XHTML 1.0 Transitional checked. Is that normal?

I would still prefer to use my design for date layout but I'm grateful to both of you for your help. Thanks. :clap:

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 8:14 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2512
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Updated zip attached to previous message.

Your validation fails Ray because it IS invalid until Cumulus has processed it - you need to validate the "tmp" file, or the final file on your web site.

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 8:20 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17562
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
mcrossley wrote:
Err, because they won't be there when the JavaScript runs?! After preprocessing by Cumulus there will just be the string.

D'oh :bash:

I shouldn't try to concentrate on more than one thing at once!

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Build 1033 comments
PostPosted: Thu Apr 12, 2012 8:21 pm 
Offline

Joined: Wed May 06, 2009 6:29 pm
Posts: 1708
Location: Cheadle Hulme, Cheshire, England
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Mark,

I copied monthlyrecord.htm from my server to my PC and validated it. I still get lots of errors. Here's a couple:-

The attribute: onclick does not conform to upper/lower case requirements.[XHTML 1.0 Transitional]

The tag:"input" is not allowed within: "input" It is only allowed within: a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, caption, center, cite, code, dd, del, dfn, div, dt, em, fields. . ..[XHTML 1.0 Transitional]

Nesting error, "input" should be closed before closing "div"[XHTML 1.0 Transitional]

I'm calling it a day now. I'll be back tomorrow for more fun.

_________________
Cheers,
Ray, Cheshire.

Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 69 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group