Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Parse dayfile.txt PHP no database

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Parse dayfile.txt PHP no database

Post by daj »

You have changed the wrong line to point to the data file

change this one -- without the # at the start

Code: Select all

$SITE['dayfile']    = '../data/dayfile.txt';

Also to view a different month ...dayfile.php?m=1
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
TNETWeather

Re: Parse dayfile.txt PHP no database

Post by TNETWeather »

Added a check for nitrx's realtime.txt. I am using a local copy of both of the daytime.txt files.

Feb:

http://cumulus.tnetweather.com/test/dayfile1.php

Jan:

http://cumulus.tnetweather.com/test/dayfile1.php?m=1

Dec 2009

http://cumulus.tnetweather.com/test/day ... =12&y=2009

I had the wrong tag for rainratemx. Fixed in the test test version above.
TNETWeather

Re: Parse dayfile.txt PHP no database

Post by TNETWeather »

Now you know why I prefer to code for weather stuff. INSTANT feedback.

I sometimes have to wait weeks to get a client to respond to something new.
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Parse dayfile.txt PHP no database

Post by nitrx »

Yeps I see , really need some rest but it doesn't quite well ;)
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Parse dayfile.txt PHP no database

Post by nitrx »

David indeed I had the wrong file hmmz no file I mean

I used the latest but I see semicolums in the output ( The Fahernheit is not important thats easy to change an d ofcourse some html :bash: Going to sleep
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Parse dayfile.txt PHP no database

Post by nitrx »

Yes it works thanks Kevin :clap:
TNETWeather

Re: Parse dayfile.txt PHP no database

Post by TNETWeather »

I have released the script on my scripts page.

http://cumulus.tnetweather.com/projects.phpdayfile

Should work with both "normal" comma deliminted dayfile.txt files and those of the unusual type with decimal commas. (duck).

Script uses the realtime.txt file to determine what the unit types are for rain, temp, pressure and wind.
TNETWeather

Re: Parse dayfile.txt PHP no database

Post by TNETWeather »

nitrx wrote:Yes it works thanks Kevin :clap:
Cool.

Looks like the only wierdnees is covered by a simple if statement and using one or the other preg_split calls. I think I could even merge them into a single call but sometimes simple is easier to support.

I will add a gallery to the support page most likely later today if someone wants to show off their page(s) using it.
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: Parse dayfile.txt PHP no database

Post by nitrx »

I think thats a good idea this script came just in time I would to make a motnth summary in excel and export it to html but this is much easier, now I've to find out a good layout but thats a weekendjob :D
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Parse dayfile.txt PHP no database

Post by daj »

TNETWeather wrote: I think I could even merge them into a single call but sometimes simple is easier to support.
I agree

Its easy to write much tighter code when you do it every day but I find that if I am writing something that is on general release and people want to understand how it works it is best to keep it simple
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
rp4111
Posts: 62
Joined: Wed 30 Dec 2009 11:31 pm
Weather Station: Davis VP2
Operating System: Windows XP, Mac OSX
Location: Western Massachusetts, USA
Contact:

Re: Parse dayfile.txt PHP no database

Post by rp4111 »

Thanks alot for this script Kevin!

A couple quick questions:

-When should i set the dayfile to be uploaded to my server?

-How do I make the it look "cleaner" like yours? Would I add that .css code that you posted on the first page to my existing css code?
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Parse dayfile.txt PHP no database

Post by daj »

rp4111 wrote:When should i set the dayfile to be uploaded to my server?
I would guess sometime after midnight -- I upload mine at 00:02
-How do I make the it look "cleaner" like yours? Would I add that .css code that you posted on the first page to my existing css code?
Yes, that would be the easiest way, assuming you have no conflicting id's or classes
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
TNETWeather

Re: Parse dayfile.txt PHP no database

Post by TNETWeather »

I set mine to 12 minutes after midnight. Wasn't if Cumulus does it right at midnight or sometime after.

WD updates stuff like that at 10 mins past.

As for CSS... I was using the following with the demo scripts:

Code: Select all

#daytable {
    width: 750px;
    border-collapse: collapse;
}

#daytable th {
    color: #ffffff;
    font-size: 75%;
    background-color: #6B6B6B;
    vertical-align: bottom;
    border: 1px solid black;
    line-height: 120%;
    text-align: center;
}

#daytable td {
    font-size: 90%;
    vertical-align: top;
    width: 9%;
    text-align: center;
    border: 1px solid black;
    padding: 2px;
}

#daytable .day {
    width: 4%;
    background-color: #6B6B6B;
    color: #ffffff;
}
Which made it look like:
You do not have the required permissions to view the files attached to this post.
rp4111
Posts: 62
Joined: Wed 30 Dec 2009 11:31 pm
Weather Station: Davis VP2
Operating System: Windows XP, Mac OSX
Location: Western Massachusetts, USA
Contact:

Re: Parse dayfile.txt PHP no database

Post by rp4111 »

Thanks Daj and Kevin. Got it working now! :clap:
User avatar
laulau
Posts: 678
Joined: Tue 13 Oct 2009 10:52 pm
Weather Station: WeatherDuino Pro2
Operating System: Win 7
Location: Meyenheim, Alsace, FR
Contact:

Re: Parse dayfile.txt PHP no database

Post by laulau »

Hi,

I'm surprised by the wind run units :!:
Is it right to show m/s or mph :?:
Laurent

Image
Post Reply