Countdown Plugin

countdown plugin by Ekkart Kleinod
Countdown to a specific date.

Last updated on 2008-04-17. Provides Syntax.
No compatibility info given!

Tagged with countdown, time, timer.

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)

Description

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>

Installation/Examples

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.

Configuration

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

Internationalisation

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:

  • German (de), English (en) by Ekkart Kleinod
  • Swedish (sv) by Peter Hultqvist
  • Polish (pl) by Malgorzata Markiewicz

Versions

  • version 2.1.1 (2008-04-17) maintained by Ekkart Kleinod: Polish language file, Swedish language file correct 'today'
  • version 2.1 (2008-03-04) maintained by Ekkart Kleinod: bugfix header warning, bugfix day computation, new parameter use_today
  • version 2.0.1 (2008-02-20) maintained by Ekkart Kleinod: Swedish language file
  • version 2.0 (2008-02-18) maintained by Ekkart Kleinod: language and configuration options, code rewrite
  • version 1.0 maintained by Ron Peters: basic functionality

Discussion

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 used floor instead of ceil for the new version 2.0. This works for me, can someone please confirm my results? Thanks, EK.
floor was wrong, ceil does 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.
 
plugin/countdown.txt · Last modified: 2008/04/17 22:53 by 88.75.94.152
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate