Page 1 of 44

Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 11:46 am
by beteljuice
Yet Another Dayfile Reader (PHP)

Release..V7.1.2 Fully php7 compliant (?)
BUG FIX caused in (v7.1.1) which was ..
MAJOR CHANGES TO SEASONAL DATA (Dec, Jan, Feb were attributed to wrong year)
Rainfall, EVT, WindRun display changed to show year / season totals / avg
Optional: Rain Days summary included with rainfall

>Large< . . . . >750 px wide< . . . . >700 px wide< with buttons ...>700 px wide< with dropdown

You should be happy with general logic and PHP.
You should be uploading your dayfile.txt to 'the web' on a regular basis.
You should have a good understanding of your own data and spot any anomalies or glitches.
You should be able to follow comments and have little (If any) instruction ! - Cumulus, saratogaWX and WeatherByYou examples in "How To" file.

It can be used as a stand-alone or dropped into a suitable site template.
It can 'read' saratogaWX templates for language and $SITE Units Of Measure decisions.
It can 'read' Weather By You templates for language decisions.

11th Jan 2020 - v7.1.2
  • beteljuice_7_1_2.zip
    Main file - betel_readDayfile - bug fix in changes to Seasonal stuff
Distribution Contains:
  • Three 'default' holders which use
    Three different css files. (plus meteo template css)
    betel_readDayfile.php

    language translations file ...
    • cs (milos.jirik)
      de (KarlS)
      en (anon)
      es (kocher)
      fi (mikkimii)
      fr (laulau)
      it (BCJKiwi)
      nl (nitrx)
      no (sutne)
      pl (pernaczy)
      pt (BCJKiwi)
    "How To" text file.
    Six graphic files (daffodil.png, hatch2.jpg, leaf.png, snowflake.png, sun.png, raindrop.png)

ALL files should be edited / saved as UTF-8 no BOM

Most dayfile data has been represented, and any unwanted options can easily be 'turned off'.

For ease of updates - main files as stand alone downloads. [They ARE included in distribution above].
betel_readDayfile_7_1_2.zip
betel_dayfile_languages_7_1.zip
betel_datasummary_css_7_1.zip
betel_Dayfile_HowTo_7_1_1.zip
Known limitations:
  • Unable to show * (incomplete data advisory) for Daylight Hours.
    Will give unreliable calculations for 'false' data which is 0 or 0.0 instead of null.
Anyone can 'play', but the beteljuice will NOT be answering any 'general' enquiries along the lines of "How do I ..." and "I want ...".

If you have unexpected figures - PLEASE check / clean-up your dayfile.txt

Edit: "Forgot To Mention"
If allowed vistors to the page will have their display unit preferences remembered by cookies for 30 days.

You can change the 'button' style menu for a 'drop-down'. (NO 'post' option)

Code: Select all

$buttons = true; // true = button options, false = dropdown options
You can change the default table from 'daily' to 'seasonal'. (or you can 'post' ?pane= ....)

Code: Select all

// which default 'table' do we want ?
if (!isset($_REQUEST["pane"])) {
    $pane = 0; // 0 default - show 'daily', 1 - show 'seasonal'
} else {
    $pane = $_REQUEST["pane"];
}
You can change the default content from Max Temp to ..... (or 'post' ?data=.... )

Code: Select all

// right at the bottom !!
if (isset($_GET['data'])) {
    $dataSet = $_GET['data'];
} else {
    $dataSet = 'maxtemp'; // default dataset
}
Edit: Dec 2019 ...
There are many things that can be 'tweaked', refer to 'How To' and comments in script.
A further suggestion from BCJKiwi for the SANITIZE list.
Just a thought about heatdays and cooldays.

I added these to the SANITIZE list quite a long time ago.
Why?
Well it seems to me that if the value on any one day is zero, then by definition it is NOT a heating day NOR a cooling day.
This change makes the average values make more sense to me.

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 12:23 pm
by water01
OK accepted the challenge!!

Here is mine minus UV and Solar, showing C, in, mph and mb as defaults and picking up dayfile.txt in default weather directory.

http://www.dmjsystems.co.uk/weather/basic.php

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 12:31 pm
by beteljuice
Your 2011 Jan => Mar data needs cleaning up ;)
Now try 'dropping' it in your own site style 'template' ..

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 1:02 pm
by water01
Don't actually have data for 2011 Jan,Feb,Mar as only started in Apr 2011, so I put in 3 dummy lines to make some other code work.

Code: Select all

01/01/11,0.0,0,17:44,9.1,23:44,20.2,18:14,1012.8,17:14,1014.6,23:14,0.0,00:00,0.0,0.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
01/02/11,0.0,0,17:44,9.1,23:44,20.2,18:14,1012.8,17:14,1014.6,23:14,0.0,00:00,0.0,0.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
01/03/11,0.0,0,17:44,9.1,23:44,20.2,18:14,1012.8,17:14,1014.6,23:14,0.0,00:00,0.0,0.0,0.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Your wish is my command http://www.dmjsystems.co.uk/weather/basic.php NB not edited into my menu system yet, next task, but need some breakfast!!

EDIT have now tidied up dayfile.txt for Jan, Feb, Mar.

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 2:49 pm
by jdc
I have broken the layout when I add my .css (which has some same names in it) and reduce width in this q&d include page here.
I had to add a font size to '#table_container table td,table th' as data table font remained large.

Functionality is spot on, data totals/averages are correct (compare with my page from db) - I would just need to sort out styling.
I only removed 'UV' and altered menu_split number.

Very nice, BTW!

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 4:21 pm
by beteljuice
@ jdc

Your columns are too narrow (or font too large !)
See baro entries (table 'breaks' container width) or where * has been added (table cells wrap)

In YOUR table_name css you need to remove your height attribute.
BTW - Your baro seems to be absolute from 18th Dec ?

I need to modify the menu 'break' code - it has given you an extra line although there is nothing to be put there.

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 4:26 pm
by beteljuice
@ David

hmm .......
Should I make all the 'content' of the 'title' transparent or fill with white ?

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 4:28 pm
by nitrx
I've a headache atm but http://apeldoorn.tk/weer/basic.php works fine even with decimal comma's 8-) have to translate and validate the data thanks for sharing Betel :geek: .


EDIT al values are rounded to nul after the decimal , have to dinner now

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 4:35 pm
by beteljuice
@ Ron - a pleasure as always, I wait for you to break it languagewise :lol:

Looks like I've got to double-check the way I create the 'season' o/p - sigh ..
EDIT al values are rounded to nul after the decimal , have to dinner now
EDIT: Bu**er - I thought forgot it isn't always . dec separator.
.. BIG problems .. don't go any further Ron .. unless you just want to play with translations.

have to pub now :?

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 4:49 pm
by nitrx
As I said I've an headace will try tthe translations asap if you need my dayfile its here for testing http://www.apeldoorn.tk/weer/dayfile.txt (I also miss december 2009 bon appetit :lol:

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 5:22 pm
by laulau
Hi,
Here is mine http://meteo.laurentmey.fr/Viewdayfile/dayfileb.php
I've a problem with "Vent" give me an error
Warning: number_format() expects parameter 1 to be double, string given in /homez.764/laurentmp/www/meteo/Viewdayfile/betel_readDayfile.php on line 510
ok with "Rafale" :oops:
Was working in prévious version.
You should put kilometers in translation section ;) !

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 7:15 pm
by water01
beteljuice wrote:@ David

hmm .......
Should I make all the 'content' of the 'title' transparent or fill with white ?
Well personally I like it, looks very clean and unfussy.

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 7:30 pm
by beteljuice
@ Laurent

Native km/h bug - to fix
Do mean eg. Kilometres ? - I had a Damn Yankee moment, sorry !

@ David

I was thinking about the dropdown selector(s) when the background 'interferes' ...

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 9:52 pm
by mikkimii
nitrx wrote: EDIT al values are rounded to nul after the decimal , have to dinner now
I have same issue here. Here is my testing in Finnish and Leuven template: http://www.phpoint.fi/leka446/weather2/index.php?p=900 (Sorry, my host is veeery slow at this moment) :evil:

I change UV to Max. Solar radiation.

Now I need few (read at least 10) beers :lol:

Re: Yet Another Dayfile Reader (PHP)

Posted: Sat 01 Feb 2014 10:29 pm
by nossis
Thanks a heap!
I have been looking at others who had similar with great admiration and dreamed that I could to. You have made my day!

Test page http://members.iinet.net.au/~nossis/weather/basic.php

I will see if I am clever enough to adjust the colorings. We get a bit hot here.

Lost the anemometer in 2013 as the data shows.
Also will investigate why not getting UV index values, had the instrument as of early 2013.

Barry