Page 1 of 4
Default Cumulus web page working in PHP using realtime.txt
Posted: Tue 08 Feb 2011 10:19 am
by fractonimbus
My default Cumulus index page now updates all the figures it can get from realtime.txt every 60 seconds, without the upload overhead of all the graphics that the normal update uses (which still operates at 15 minute intervals).
See
http://www.dcnicholls.com/wx/
I recoded the indexT.htm page to include some of the PHP code from the banner.php code (
http://cumulus.tnetweather.com/projects/phpggbanner), added a few steps to generate stuff that's not in the realtime.txt (Beaufort scales, apparent temperature). I also added a Fire Danger Index value, using the CSIRO equation.
In order to get Cumulus to do the updating, I had to retain the indexT.htm name, so I had to get my website server (IIS) to parse .htm files as PHP. Works well.
The only thing I don't have updating (of the met figures) is "Last rainfall" which I leave for the 15 minute full update to do.
fracto
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 10:51 am
by daj
fractonimbus wrote:In order to get Cumulus to do the updating, I had to retain the indexT.htm name, so I had to get my website server (IIS) to parse .htm files as PHP. Works well.
Just a tip....
Far better to have asked Cumulus to upload a custom file with the values you need in a PHP file. You are adding unnecessary overhead to your IIS server as it now needs to parse every HTML page just in case it has PHP.
You should upload a very small PHP file with the data, and the index.php file on the server uses this.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:05 am
by steve
fractonimbus wrote:added a few steps to generate stuff that's not in the realtime.txt (Beaufort scales, apparent temperature).
Beaufort number and Apparent temperature are both in realtime.txt.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:31 am
by fractonimbus
David, thanks for the suggestion. I didn't think about generating custom upload files. Why I did what I did was to reduce the large upload of the full file set too often. realtime.txt is small and can be programmed in Cumulus to upload frequently, independently of the main upload, without large overhead.
Steve, yes, your other answer about the four extra realtime.txt values lead me to discover the information. Makes it easier. Though I was a bit worried about your comment elsewhwere on the equation cumulus uses being wrong or needing checking. I'll compare my version with the Cumulus version.
What this was really about was learning PHP and getting a weather page working.
DN
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:42 am
by beteljuice
Urrgh ......... page refresh !
Why aren't you using one of the (many) flavours of Ajax to update your content ?
Edit:
You may want to trial / experiment with SaratogaWX (Ken True) revamp of a long established Ajax 'theme' which is now supporting Cumulus.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:46 am
by daj
beteljuice wrote:Urrgh ......... page refresh !.
I agree

lol
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 11:56 am
by steve
fractonimbus wrote:Though I was a bit worried about your comment elsewhwere on the equation cumulus uses being wrong or needing checking.
Was that some time ago, just after I'd added Apparent temperature to Cumulus? There may have been some initial teething troubles, as with any new facility, but I'm reasonably confident it's correct.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 12:25 pm
by fractonimbus
beteljuice wrote:Urrgh ......... page refresh !
Why aren't you using one of the (many) flavours of Ajax to update your content ?
Well, I could add an animated GIF, too, if you like
I tend to use whatever is light weight, not what is trendy. The Style Sheet Police decry the use of tables, too. But tables are simple, work in every browser since Cello, and are very configurable. For a quick page refresh, it's hard to beat the meta refresh line for brevity
I like simple and clean. Ken True's main web page may be good technology but it looks like a web version of the Batmobile
But I will follow up on Ajax when I get time. The Saratoga stuff looks interesting.
Steve, thanks for the info on apparent temp. I'll swap over to using the new 1.9.1 realtime.txt content.
DN
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 1:04 pm
by laulau
beteljuice wrote:Urrgh ......... page refresh !
What do you suggest to replace the "

HTTP-EQUIV="Refresh" " html code

Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 1:25 pm
by fractonimbus
steve wrote:Beaufort number and Apparent temperature are both in realtime.txt.
Steve, FYI I checked the Apparent Temperature against the BOM formula and they're giving exactly the same result. So all OK.
DN
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 1:32 pm
by steve
OK - thanks.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 2:00 pm
by daj
laulau wrote:beteljuice wrote:Urrgh ......... page refresh !
What do you suggest to replace the "

HTTP-EQUIV="Refresh" " html code

Learn/Use Javascript & Ajax calls to re-read the data file in the background and only update the data on the page rather than reloading the entire page each time.
Many of us use this technique -- on my site, the "Near Live" and "Weather Console" employ this method
I use a jQuery library (collection of Javascript functions) which makes the Ajax calls just a little easier to code.
(Ajax is simply a term used to describe Javascript methods to retrieve data in the background of the page)
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 4:58 pm
by tjaliwalpa
daj wrote:laulau wrote:beteljuice wrote:Urrgh ......... page refresh !
What do you suggest to replace the "

HTTP-EQUIV="Refresh" " html code

Learn/Use Javascript & Ajax calls to re-read the data file in the background and only update the data on the page rather than reloading the entire page each time.
Many of us use this technique -- on my site, the "Near Live" and "Weather Console" employ this method
I use a jQuery library (collection of Javascript functions) which makes the Ajax calls just a little easier to code.
(Ajax is simply a term used to describe Javascript methods to retrieve data in the background of the page)
Question: Wouldn't the use of jQuery and Ajax calls work without using PHP?
I ask this as I am using a server that doesn't have PHP enabled. It occured to me, having read all the above posts, that I could use that method to have my data updated on the main page in the way you have the Weather Console working (and I have my scrolling marquee working) without PHP.
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 5:06 pm
by daj
tjaliwalpa wrote:Question: Wouldn't the use of jQuery and Ajax calls work without using PHP?
Indeed -- PHP and Javascript/jQuery are different beasts.
PHP is processed on the server before it gets to the browser.
JS/jQuery on your browser
You can mix them (or not)
Re: Default Cumulus web page working in PHP using realtime.t
Posted: Tue 08 Feb 2011 5:20 pm
by tjaliwalpa
Thanks David, something for me to work on. The refresh I have been using (with reload.js) has been annoying me.
