Countdown is an extension that allows users place a countdown ticker on wiki pages.
Parameters[]
Name | Desc |
---|---|
time | The time we are counting down to. Accepts anything that PHP's strtotime function can accept. |
name | An identifier for this countdown. If not provided, a random string will be generated. (this is just used so multiple countdowns can exist on a page, and you probably don't have a reason to customize it unless you need to reference it in custom javascript) |
finishmessage | A message to display when the countdown is finished. This text will replace everything inside the countdown tag. |
Usage[]
This example will show a countdown to a birthday.
<countdown time="03/26/2055 00:00:00" name="bday" finishmessage="Happy Birthday, Cchunn!"> Cchunn's Birthday is in: <D> Days, <H> hours, <M> minutes, <S> seconds. </countdown>
Use with templates[]
The functionality can be expanded on a bit with the use of templates. Here is an example template used on the Exvious wiki:
<!-- Template:Countdown --> <includeonly> {{#ifexpr: {{#expr: ( {{#time: U | now -8 hours}} > {{#time: U | {{{end|01/01/01 00:00:00}}} }} ) }} | '''{{{finished|}}}''' | {{#ifexpr: {{#expr: ( {{#time: U | now -8 hours}} > {{#time: U | {{{start|01/01/01 00:00:00}}} }} ) }} | '''{{{text|}}} ends:''' {{#tag: countdown | '''<D> days, <H> hours, <M> minutes, <S> seconds.''' | time="{{{end|01/01/01 00:00:00}}} UTC-0800" }} | '''{{{text|}}} starts:''' {{#tag: countdown | '''<D> days, <H> hours, <M> minutes, <S> seconds.''' | time="{{{start|01/01/01 00:00:00}}} UTC-0800" }} }} }} </includeonly> <noinclude>[[Category:Templates]]</noinclude>
The template can then be called to have a countdown to a "start" and then the countdown to an "end".
{{countdown |text = Event |finished = Event has ended. |start = 01/27/17 00:00:00 |end = 02/02/17 23:59:59 }}
Using this template, if you are before the "start" you will see:
Event Starts: ''' 2 Days, 2 Hours, 2 Minutes, 2 Seconds '''
or if you are past the start but before the end:
Event Ends: ''' 2 Days, 2 Hours, 2 Minutes, 2 Seconds '''
or if you are past the end:
Event has ended.