Extension talk:EventCountdown

From MediaWiki.org
Jump to: navigation, search
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

I like this extension. It's very handy and I enjoy using the two tags together, like so:

<eventcountdown date="14-Jun-2016">Happiness is <daysuntil in="days">14 Jun 2016</daysuntil> away.</eventcountdown>


Would it be at all possible to have some alternative text that replaces the <eventcountdown>, as soon as it reaches 14 Jun 2016? Maybe done in the style:

<eventcountdown date="14-Jun-2016" become="Welcome to happiness">Happiness is <daysuntil in="days">14 Jun 2016</daysuntil> away.</eventcountdown>

SimonMayer 03:14, 14 June 2006 (UTC)

I think the major problem is, that it don't move on every day... --84.154.158.211 08:03, 7 July 2006 (UTC)

This doesn't update automatically. I was under the impression it would when I installed it. So, is that an error with my wiki/extension or is this extension just not supposed to update unless I do a blank edit to the page? --Mijunkin 17:17, 25 October 2006 (UTC)

Contents

[edit] Question about multiple EventCountdown items in a document

Is it possible to use multiple EventCountdown items - sort of like creating a task list?

<eventcountdown date="8-Sep-2006">Item 1 Friday is <daysuntil in="days"> 8 Sep 2006</daysuntil> away. </eventcountdown>

<eventcountdown date="9-Sep-2006">Item 2 Saturday is <daysuntil in="days"> 9 Sep 2006</daysuntil> away. </eventcountdown>

Thanks,

Steve

[edit] error report

I'm using MW 1.9.3 With tag <daysuntil> everything works fine, buy when i'm using <eventcountdown> whole page brakes... I mean for example any other extensions wchich uses <> brakes won't work on this page. For example extension witch syntax <gg>1234567</gg> looks like that: UNIQ1a5097014d924d70-gg-0000001A-QINU

Any idea what shall I do with it? --193.39.71.4 23:01, 24 April 2007 (UTC)

[edit] UNIQ problem

I think it's to do with the recursion in the parsing. The newest method seems to be this. See new replacements for commented out code below.

//function runShowEventCountdown( $input, $argv ) {
function runShowEventCountdown( $input, $argv, &$parser ) {
       $now = time();
       if (!array_key_exists("date",$argv)) return "";
       $then = strtotime($argv["date"]);
       $daysUntil = getDaysBetween($now, $then);

       $output = "";

       if ($daysUntil > 0) {
               //global $wgOut;
               //$output = $wgOut->parse($input, false);
               $output = $parser->recursiveTagParse($input);
       }

       return $output;
}

Also it would be nice to have the extension details added.


[edit] Solution for the localization problem

function day_name() {
        global $wgContLang;
 
        $messages = $wgContLang->messages['ipboptions'];
        $desc = array('day', 'days'); //Some default values
 
        if(preg_match('/1 ([^:]+):1 day/', $messages, $matches))
                $desc[0] = $matches[1];
 
        if(preg_match('/[2-9]+ ([^:]+):[2-9]+ days/', $messages, $matches))
                $desc[1] = $matches[1];
 
        return $desc;
}

This function works for me, but it isn't tested with all languages.

[edit] Upgrade (Redundancy)

How to enable redundancy on an event ?

I want use it for a online game wiki and some events have redundancy. Is it possible to activate it with a time before repeat ?

Tks for your extension.

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox