====== Countdown Plugin ====== ---- plugin ---- description: Countdown to a specific date. author : Ekkart Kleinod email : ekkart@ekkart.de type : syntax lastupdate : 2008-07-20 compatible : depends : conflicts : similar : tags : timer, time, countdown ---- By [[ekkart@ekkart.de|Ekkart Kleinod]] (since version 2.x). This is version 2.1.2 of the plugin by [[rbpeters@peterro.com|Ron Peters]] (version 1.0). Version 1.0 was a modified version of the [[http://wakka.xiffy.nl/countdown|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 [[http://www.dokuwiki.org/wiki%3Aplugins|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: This will be replaced with either XX days until description XX days since description Possible formats of //date// are all [[http://www.gnu.org/software/tar/manual/html_node/tar_115.html#SEC115|GNU date formats]] that are allowed by [[http://www.php.net/strtotime|strtotime]]. Examples: ===== Installation/Examples ===== Install with Plugin Manager from [[http://www.ekkart.de/downloads/computer/countdown-2.1.2.zip|ekkart.de]]. If this does not work or manual installation is preferred, [[http://www.ekkart.de/downloads/computer/countdown-2.1.2.zip|download the plugin]] and unzip the content into the //plugins// directory. Examples of use are given on [[http://www.ekkart.de/doku.php/computer:dokuwiki|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 * Estonian (et) by Mikk Leini ===== Versions ===== * version 2.1.2 (2008-07-20) maintained by Ekkart Kleinod: Estonian language file * 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@geoffroberts.net|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 or that can override the default config option? > Sounds good, depends on how much time I have these days. EK.