Page 2 of 4
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 9:57 pm
by Synewave
The way I achieved it is started off with DAJ's console script (which updates automatically), then realised the method could be used to drive the whole site using that realtime method. So after understanding how it works and plenty of customisation, it works a treat.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 10:15 pm
by gemini06720
Synewave wrote:The way I achieved it is started off with DAJ's console script (which updates automatically), then realised the method could be used to drive the whole site using that realtime method. So after understanding how it works and plenty of customisation, it works a treat.
Sure, now all of your website (weather display) updating is being done on the user's computer...

Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 10:24 pm
by Synewave
gemini06720 wrote:Synewave wrote:The way I achieved it is started off with DAJ's console script (which updates automatically), then realised the method could be used to drive the whole site using that realtime method. So after understanding how it works and plenty of customisation, it works a treat.
Sure, now all of your website (weather display) updating is being done on the user's computer...

Is that an issue?
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 10:50 pm
by tjaliwalpa
Synewave wrote:The way I achieved it is started off with DAJ's console script (which updates automatically), then realised the method could be used to drive the whole site using that realtime method. So after understanding how it works and plenty of customisation, it works a treat.
Just to see if and how it works, I've tried a few fields (temp and apparent temp) in my opening page using realtime.txt and java update every 20sec. As I said, I don't use a server with PHP so it isn't an option.
gemini06720, what is the issue with using java to update?
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 10:56 pm
by daj
There are various ways to crack a nut....Ray (gemini) may prefer an alternative. There is certainly nothing fundamentally wrong in using Ajax loads. It is far better to refresh a page changing only the data rather than the whole page again. Equally you should let your user know that you are doing data refreshed in the back ground -- most of us do as we show a count down timer so it is obvious.
One thing to consider -- if a user visits your site and Javascript is disabled on their browser they will not get much from your page/site. Equally I doubt they would get much from most pages on the internet. LOL
I maybe would not do Ajax loads for my whole site, but that's just a personal choice.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:33 pm
by gemini06720
Synewave wrote:gemini06720 wrote:Synewave wrote:The way I achieved it is started off with DAJ's console script (which updates automatically), then realised the method could be used to drive the whole site using that realtime method. So after understanding how it works and plenty of customisation, it works a treat.
Sure, now all of your website (weather display) updating is being done on the user's computer...

Is that an issue?
To the contrary, you are somewhat relieving your host server...
Paul, rather than forcing a complete page refresh (with a meta tag) which forces the host server to produce a completely new page (and download that newly created/updated page to the user's computer), the JavaScript (which is running on the user's computer) looks for changes in the 'realtime.txt' file (I presume this is the file that is being used by your script) and updates the web page (that is stored in the user's browser cache directory) with only the values that have changed...

Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:44 pm
by Synewave
That's how I understood it worked, so that's good.

It reads from realtime.txt and an additional realtime file containing all the other tags processed by Cumulus that I want to use.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 1:36 am
by fractonimbus
David,
Quick question about Ajax and jQuery: I presume jQuery is an Ajax application?
Looking at your WeatherConsole package, it seems a good approach to use in place of my PHP escapades
I like the idea of not having to refresh the whole page, and I'm noticing that the combination of PHP and meta refresh occasionally leaves some of the entries unfilled. Presumably due to slow processing of the PHP code.
DN
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 9:41 am
by daj
fractonimbus wrote:I like the idea of not having to refresh the whole page, and I'm noticing that the combination of PHP and meta refresh occasionally leaves some of the entries unfilled. Presumably due to slow processing of the PHP code.
DN
Why you still doing a meta-refresh?!
PHP is only executed once, on the server, as it delivers the page. After than leave it to jquery/JS to read the data and update the data on the page.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 9:57 am
by fractonimbus
David,
I've abandoned (for the moment) PHP and am recoding the index page using your wconsole.html page as a guide. I agree it's vastly better than the PHP effort. See a mock up page with some of the variables responding to jquery/JS updates at
www.dcnicholls.com/wx/ind_test.html . So far so good but not everything is yet working (ie page is partly static).
DN
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 10:08 am
by daj
Excellent, well done.
I would consider adding a little count down to the page to let visitors know when it will next update, or just a message to say it will refresh every x minutes/seconds?
One 'flaw' with my 'console' code is that initially the data is blank, and then quickly filled out by the Ajax calls. I should really change it so that the initial page load has data, or at least shows a message while it loads the first set.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 10:15 am
by Synewave
fractonimbus wrote:David,
I've abandoned (for the moment) PHP and am recoding the index page using your wconsole.html page as a guide. I agree it's vastly better than the PHP effort. See a mock up page with some of the variables responding to jquery/JS updates at
http://www.dcnicholls.com/wx/ind_test.html . So far so good but not everything is yet working (ie page is partly static).
DN
Excellent job!
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 10:18 am
by fractonimbus
Hi David,
Yes, the lack of a countdown is just because I'm still working on it.
I also need (1) to work out how to parse the date and time to get the current static webpage values from the data in realtime.txt.
And (2) I need to work out the Javascript to calculate the Fire Danger Index.
And also (3) the Last Rainfall data, which is not part of the realtime.txt. Is there a way to get Cumulus to add parameters to realtime.txt, or to some small text file to upload at the same time?
Ideally the dawn dusk, sun and moon etc data would be nice to include, too, but I may have to let the regular upload process do that (which is what I did with the PHP page).
DN
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 10:20 am
by Synewave
daj wrote:One 'flaw' with my 'console' code is that initially the data is blank, and then quickly filled out by the Ajax calls. I should really change it so that the initial page load has data, or at least shows a message while it loads the first set.
If you come up with something, I'd be really interested. The other problem is that if the Javascript is reading the realtime file at the time Cumulus is uploading it, the data shows strange HTML code.
I've overcome this somewhat by getting a good combination of realtime upload interval and the javascript refresh settings.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Wed 09 Feb 2011 10:26 am
by daj
fractonimbus wrote:And also (3) the Last Rainfall data, which is not part of the realtime.txt. Is there a way to get Cumulus to add parameters to realtime.txt, or to some small text file to upload at the same time?
Ideally the dawn dusk, sun and moon etc data would be nice to include, too, but I may have to let the regular upload process do that (which is what I did with the PHP page).
DN
You don't need to use the default realtime.txt file, you could build your own using webtags or create a second one. Example
realtime-extras.txt
<#sunrise> <#sunset> <#dawn> <#dusk>
Get Cumulus to process this file in realtime and it will upload too. Your code can then parse this additional file for the extra data