PHP (No Database) Dayfile.txt Parser
A simple PHP5 based script that uses the Cumulus dayfile.txt file to generate a table of a selected months data.
Requirements
- PHP 5 (untested in PHP4 though I can't think of anything that would not work)
- Cumulus Version 1.89 or higher.
- Method of uploading the dayfile.txt file from the Cumulus workstation data directory at some interval that makes sense.
Configuration
The source is in text form. You need to download it and save it on your server as dayfile.php
After you have saved it, you need to change the setting section to match what you require. For most, the default settings will work.
Default Settings are:
$SITE['realtime'] = './realtime.txt';
Dayfile
The dayfile.txt file is NOT automatically sent to your website, nor is it something you can normally do via Cumulus itself as it has no options for sending a file only once a day.
The dayfile.txt is updated on your Cumulus workstation once a day after midnight.
You can use another FTP tool or something like:
You just need to know where it is being uploaded to so that you can set the script properly.
Realtime.txt
The realtime.txt file is used to obtain the unit types for wind, rain, pressure and temp. None of the other data is used for this script.
Options
There are currently two options that can be passed to the script.
By Default, the script will display the current months data. The two options will allow you to change that.
| Option | Effect |
|---|---|
| m=XX | Month is changed to the value you provide |
| y=XXXX | Year is changed to the value you provided (4 digit years only) |
Note that options are passed on the URL line after the script name. The first option needs to start with a ? and the second with an &
Examples:
| Example | Result |
|---|---|
| http:/....sonesite/dayfile.php?y=2009&m=12 | Displays Dec of 2009 |
| http:/....sonesite/dayfile.php?y=2010&m=1 | Displays Jan of 2010 |
Sample
A number of months are available here:
CSS code
The current script is really intended to be include by another page which has an external or inline CSS style page.
You could use the following to get a start on how to make it look...
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;
}
