PHP / html Level: beginner => Intermediate
IMPORTANT ***
Your server MUST be running PHP ver 5+ and if 'safe_mode' exists it should be "off".
If you are unsure of the above, unzip and run the following file in your webspace: If it suggests that safe_mode is enabled, check your web space control panel / settings and see if you can turn it "off", else contact your support.
If they say "Oh no can't do that its insecure", tell them its caused so much problems that it is depreciated in ver 5.3 and doesn't even exist in ver 5.4 ! - give them this link: http://uk.php.net/manual/en/features.safe-mode.php
You will also need a 'library' of day / night icons with the correct naming format such as available from jacquesD - if you are unable to fufil the requirements the prog should just return the 'light' version icon.
The naming convention and <#webtag> alternative using <#isdaylight> is discussed HERE
OK so far
Functionality:
The code 'pretends' to be a graphic and will accept time and forecast via a <#webtag> (Template) type page OR realtime.txt if you are uploading that. If no (report) time is forwarded it will assume 'now'.
It artifically advances the next twilight event by user defined number of hours (default 4)
In order to do this correctly you must set your timezone, longitude and latitude.
This also means that it should work in any town in the world at any time of year (think light or dark varying between minutes and months !)
If a (report) time has been forwarded and is older than 7 hours (can be set by user) then N/A icon graphic will be displayed.
V1.0 - August 2012
- Initial release
Unzip the file and using a txt editor like Notepad++ change the user setting to your locale and upload to your web space - double-check you have the correct paths for your icons and (if used) realtime.txt (don't forget to upload icons if you haven't done so already
Usage:
minimal html coding for Template using <#webtag>s
Code: Select all
<!-- prefered, using report timestamp -->
<img src="ficon.php?fno=<#forecastnumber>&event=<#date format="yyyy'-'mm'-'dd'*'hh:nn">" />
<!-- using 'now' timestamp -->
<img src="ficon.php?fno=<#forecastnumber>" />
Code: Select all
<img src="ficon.php" />