countdown plugin by Ekkart Kleinod
Countdown to a specific date.
Last updated on 2008-04-17. Provides Syntax.
No compatibility info given!
By Ekkart Kleinod (since version 2.x). This is version 2.1.1 of the plugin by Ron Peters (version 1.0). Version 1.0 was a modified version of the nucleuswiki plugin by Trent Adams and Edmond Hui
Important: version 2.x not compatible with version 1.0 (syntax change of date)
With this plugin you can insert a countdown into your page where it will display the number of days until or since the text that you include. The format is:
<COUNTDOWN:date|description>
This will be replaced with either
XX days until description XX days since description
Possible formats of date are all GNU date formats that are allowed by strtotime. Examples:
<COUNTDOWN:mm/dd/yyyy|day to remember> <COUNTDOWN:dd.mm.yyyy|Ereignis>
Install with Plugin Manager from ekkart.de.
If this does not work or manual installation is preferred, download the plugin and unzip the content into the plugins directory.
Examples of use are given on ekkart.de.
The plugin is configurable in some ways since version 2.0.
First there is a config parameter to switch the visibility of the countdown date in the output. The parameter is a boolean switch, set it to 1 for date output, to 0 otherwise.
The parameter is set in file conf/default.php:
$conf['plugins']['countdown']['include_date'] = 0;
or
$conf['plugins']['countdown']['include_date'] = 1;
results in
XX days until description
resp.
XX days until description (mm/dd/yyyy)
Second there is a config parameter to switch the output if the date is today. The parameter is a boolean switch, set it to 1 for “today is”, to 0 for “0 days to”.
The parameter is set in file conf/default.php:
$conf['plugins']['countdown']['use_today'] = 0;
or
$conf['plugins']['countdown']['use_today'] = 1;
results in
0 days until description
resp.
Today is description
The output format of the date can be set in file lang/xx/lang.php where xx stands for your preferred language.
This file contains the language dependent texts too.
Feel free to edit these files or create new ones for your language.
If you want your language file to be integrated into the plugin, please send them to me.
Please tag your email subject with [countdown].
The following languages are included:
Does this plugin work properly with leap years?
Yes it does — Geoffrey Roberts 2008-02-02 12:23
There is a small bug with the plugin. Basically it miscounts the number of days as it does not round hours correctly. This can be fixed by replacing:
$the_time = sprintf("%.0f",abs($time));
with:
$the_time = sprintf("%.0f",ceil(abs($time)));
I usedfloorinstead ofceilfor the new version 2.0. This works for me, can someone please confirm my results? Thanks, EK.floorwas wrong,ceildoes the trick, even without abs()
How about <COUNTDOWN:mm/dd/yyyy&date|day to remember> or <COUNTDOWN:mm/dd/yyyy&nodate|day to remember> that can override the default config option?
Sounds good, depends on how much time I have these days. EK.