Page 3 of 5
Re: Yearly Data Summary
Posted: Mon 07 Mar 2011 10:54 pm
by daj
A PHP version is also now included in the 'pack'
http://wiki.sandaysoft.com/a/AnnualDataSummary
Functionality, control and configuration are identical in both version. To re-iterate, the PHP version in theory is faster as all the work is done on the webserver and only the results sent to the users browser. Whereas the JS (Javascript) version sends all data to the browser for processing. With a decent browser and only a few years of data in the dayfile you will probably not notice the difference. Use IE7 and you might just notice a pause with the JS version.
If you are happy with the JS version already no need to change as they both do exactly the same thing.
I just thought I would offer some flexibility
Sample (one is php the other is JS)...
http://grantownweather.co.uk/ds/datasummary.php
http://grantownweather.co.uk/ds/datasummary.html
(did you spot the different, no!)
Enjoy
Re: Yearly Data Summary
Posted: Mon 07 Mar 2011 11:07 pm
by GraemeT
Now you've gone and taken ALL the work out of it.
Thanks David.
Re: Yearly Data Summary
Posted: Mon 07 Mar 2011 11:21 pm
by Graham64
David
I wanted to add 'Bright sunshine hours' to the annual summary and because your program is so concise and easy to follow I have managed it, even with a very low knowledge of JS (see
http://poundstockpacket.org.uk/datasummary.html)
My only problem now is to make the table narrower so that it fits with the rest of my website. I have altered the css and reduced widths and margins but do not understand one thing. How have you got the font for the Min/Max readings to be smaller than the other data sets? I can't see how the css does it.
Thanks for a brilliant addition to the software. I am finding it a great introduction to learning Javascript and PHP. My next task is to get the sun hours working in PHP.
Graham
Re: Yearly Data Summary
Posted: Mon 07 Mar 2011 11:27 pm
by daj
Graham
Line 25 of your version of the CSS
#table_container .smallfont { font-size: 70%;}
I apply the 'smallfont' class to the data cells if I am showing two sets of figures (i.e. Max & Min) at once
I intend to offer more data sets on the table once version 1.9.1 of Cumulus comes out of beta. I tend not to develop anything for a beta version of Cumulus just in case anything changes
Re: Yearly Data Summary
Posted: Mon 07 Mar 2011 11:44 pm
by Graham64
David
Thanks for the css/JS explanation. I think I understand! I now need to look more closely at the reason for the different values of dayfilecol2 (perhaps tomorrow).
I did wonder if you were deliberately restricting values to those in 1.9.0. But I thought that it was a good opportunity for me to learn more about JS by including the sun hours.
Thanks for your help.
Graham
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 4:36 am
by Super-T
Having a problem with the correct naming of the source of the dayfile.txt
Java works ok as
var dayfile='/weather/data/dayfile.txt'; but PHP can't find the file as
$dayfile='/weather/data/dayfile.txt';
http://www.janter.co.nz/weather/data/datasummary.php
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 6:27 am
by DaveNZ
Super-T wrote:Having a problem with the correct naming of the source of the dayfile.txt
Java works ok as
var dayfile='/weather/data/dayfile.txt'; but PHP can't find the file as
$dayfile='/weather/data/dayfile.txt';
http://www.janter.co.nz/weather/data/datasummary.php
Yeah, / at the beginning doesn't work as you would expect with PHP - as PHP is looking at the folder structure of the whole site, not just the public html folder.
I would use
Code: Select all
$dayfile= $_SERVER['DOCUMENT_ROOT'] . "/weather/data/dayfile.txt";
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 9:46 am
by daj
Terry
As Dave has said, the PHP path to dayfile.txt will be different for JS or PHP version.
Remember, PHP runs on the server so the path is relative to where the server finds the file, often it will start with public_html/ or /www, etc.
JS runs on the users browser so the path is relative to what the browser sees
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 10:07 am
by nitrx
Well I don't understand what to fill out for the dayfile.txt the complte path is
http://www.apeldoorn.tk/weer/realtime.txt but I don't get output
http://www.apeldoorn.tk/weer/datasummary.php stupid paths

Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 10:11 am
by daj
You need to know where you upload your files to. The 'directory' listed in the Cumulus Internet settings probably needs included.
Anyway, try this and the system should work it out...
$dayfile= $_SERVER['DOCUMENT_ROOT'] . "/weer/dayfile.txt";
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 10:14 am
by nitrx
daj wrote:You need to know where you upload your files to. The 'directory' listed in the Cumulus Internet settings probably needs included.
Anyway, try this and the system should work it out...
$dayfile= $_SERVER['DOCUMENT_ROOT'] . "/weer/dayfile.txt";
Doen't work either already tried...
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 10:17 am
by nitrx
Oeps my fault filled out a wrong delimiter sorry , thanks , have some coffee

Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 4:02 pm
by SouthUistWX
I think i must be doing something wrong with this. The page seems to load up OK when i first navigate to it
http://www.southuist-weather.info/datasummary.php but when i then choose one of the other options (Min temp, Av temp, Min/Max etc.) i keep getting an error message.
my readDayfile.php, datasummary.php, datasummary.css and my dayfile.txt are all in the same directory
Doesn't help matters much in that i don't really know what the heck i'm doing
Thanks, any help gratefully received!
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 5:40 pm
by daj
Sounds like your webserver may be on an old version of PHP
Create a text file with the following content
Code: Select all
<?php
echo 'Current PHP version: ' . phpversion();
?>
Save as version.php (or anything you wish with a .php at the end)
Upload the file to your webserver
In your webbrowser, open the file...
http://www.southuist-weather.info/version.php
What version does it report?
Re: Yearly Data Summary
Posted: Tue 08 Mar 2011 6:17 pm
by SouthUistWX
Hi David
Yes, i think you are right, I checked the php version on the server just a couple of days ago as there was something else i couldn't get to work - it says php version 4.4.9
Thanks
Yvonne