Page 2 of 3
Re: Humidity Unit Tag?
Posted: Mon 14 Jan 2013 6:49 pm
by William Grimsley
Hi Steve,
Yes, I knew you could do that. But, of course that wouldn't be any help for what I was trying to do.
Thanks again,
Will
Re: Humidity Unit Tag?
Posted: Mon 14 Jan 2013 9:02 pm
by laulau
Hi Will,
Did you notice that you have %% in your banner ?

Re: Humidity Unit Tag?
Posted: Mon 14 Jan 2013 9:30 pm
by William Grimsley
Hi laulau,
No, I didn't notice! Thanks for telling me!
EDIT: Fixed the "%%" error in the banner.php file. Also, I have fixed the "%%" error in the ajax-gizmo.php file.
Re: Humidity Unit Tag?
Posted: Mon 14 Jan 2013 10:52 pm
by KevinF
Don't forget to fix 'dew'
Should read 'DewPt'
KF
Re: Humidity Unit Tag?
Posted: Tue 15 Jan 2013 7:50 am
by William Grimsley
I didn't notice that! Thanks for telling me!
EDIT: Fixed the "Dew" error and replaced with "Dew Pt" in the banner.php file.
Re: Humidity Unit Tag?
Posted: Tue 15 Jan 2013 1:51 pm
by KevinF
You're welcome.
KF
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 8:00 pm
by William Grimsley
Hi Steve,
Ok, I'm trying to add '/hr' after the <#rrate> web tag, like this:
From:
To:
But, then my website shows 'NaN mm'!
What's going on?
William
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 8:10 pm
by steve
My guess would be that you have that in some script/PHP, rather than HTML, so the interpreter is trying to divide by "hr", hence 'not a number'. I'd need to see your change in context.
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 8:16 pm
by William Grimsley
steve wrote:I'd need to see your change in context.
Is this what you mean?
Code: Select all
var rainratehr = convertRain(realtime[8]); // make per hour rate.
set_ajax_obs("ajaxrainratehr",rainratehr.toFixed(dpRain) + uomRain);
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 8:31 pm
by steve
I can't see the <#rrate> web tag there at all, nor any sign of "/hr".
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 8:49 pm
by William Grimsley
Steve,
If, you are wanting to see the HTML code, look here:
From:
To:
If, you are wanting to see the PHP code, look here:
Code: Select all
var rainratehr = convertRain(realtime[8]); // make per hour rate.
set_ajax_obs("ajaxrainratehr",rainratehr.toFixed(dpRain) + uomRain);
Hope this helps...
William
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 9:06 pm
by steve
This is how the standard Cumulus index.htm HTML web page template does it:
Code: Select all
<td><#rrate> <#rainunit>/hr</td>
I have no idea how the HTML you're quoting is related to the PHP you're quoting. If you're using <#rrate>/hr in your realtime.txt file, and that is realtime[8] in your PHP, then what you are doing, I would guess, is passing the the rain rate with "/hr" on the end of it to a function (convertRain) which is expecting a number. What you need to do is put the "/hr" onto your web page, not into your realtime.txt file, and I can't offer any help with that.
Re: Humidity Unit Tag?
Posted: Thu 21 Mar 2013 9:20 pm
by William Grimsley
Hi Steve,
Ok, I've tried with PHP and that works.
But, with AJAX I can't get it to work because it's PHP that I'm trying to include in AJAX code. So, I must have to root round my ajaxCUwx.js file in order to accomplish what I want!
Thanks for your help,
William
Re: Humidity Unit Tag?
Posted: Fri 22 Mar 2013 12:17 am
by beteljuice
Code: Select all
var rainratehr = convertRain(realtime[8]); // make per hour rate.
set_ajax_obs("ajaxrainratehr",rainratehr.toFixed(dpRain) + uomRain);
That is JavaScript and in order for it to work the html must be something like:
The original Ajax call replaces the contents of the span with rainratevalue unitof(rain)measure. eg. 21.5 mm
To add /hr just put that immediately after the named span in the
html
Re: Humidity Unit Tag?
Posted: Fri 22 Mar 2013 7:06 am
by William Grimsley
beteljuice wrote:Code: Select all
var rainratehr = convertRain(realtime[8]); // make per hour rate.
set_ajax_obs("ajaxrainratehr",rainratehr.toFixed(dpRain) + uomRain);
That is JavaScript and in order for it to work the html must be something like:
The original Ajax call replaces the contents of the span with rainratevalue unitof(rain)measure. eg. 21.5 mm
To add /hr just put that immediately after the named span in the
html
Hi beteljuice,
Ok, your idea works but it doesn't flash when the ajax-dashboard.php file updates with mm! It should flash as mm/hr. The mm only flashes, at the moment.
Thanks for your help,
William