[Mediawiki-l] {{CURRENTMONTHNAME}} minus one

Joshua Yeidel yeidel at wsu.edu
Wed Mar 15 20:38:36 UTC 2006


I just found a way to compute the correct string in PHP.  I don't know how
to make it available as a "magic word".  I looked at the "meta" site and the
code, but I didn't find an easy solution.

It is possible that a solution could come from the world of templates -- I'm
not an expert, but it seems doable.  For example, you could have an array
that is indexed by {{CURRENTMONTH}} which gives the previous month's name.

En.wikipedia.org has a DAYSUNTILSUNDAY template that might prove
instructive.  It does a lookup into an array that returns a string based on
the day of the week.  Yours would return a string based on the month number.
You will also need to have (or add) Template:array from wikipedia to your
wiki.

That's about all I can do on this now.  Perhaps someone else can add.

-- Joshua



On 3/15/06 2:38 AM, "Bierens,Gerard G.J.M." <G.Bierens at fontys.nl> wrote:

> Hello Joshua,
> That makes sense to me, but where do I add this code?
>  
> -- Gerard
>  
> Joshua Yeidel yeidel at wsu.edu
> <mailto:mediawiki-l%40Wikimedia.org?Subject=%5BMediawiki-l%5D%20%7B%7BCU
> RRENTMONTHNAME%7D%7D%20minus%20one&In-Reply-To=399E1B1730511340ACC9D56B8
> 48CFF652443D4%40KOOTENAY.medewerker.fontys.local>
> 
> Sat Mar 11 02:23:17 UTC 2006
>  
> Try:
>  
> $lastmonthname = date("F", mktime(0, 0, 0, date("m")-1, date("d"),
> date("Y")));
>  
> It may depend on your version of PHP;  there have been changes to
> date/time
> functions, some of which are documented at:
>  
> http://us2.php.net/manual/en/function.date.php
> <http://us2.php.net/manual/en/function.date.php>
>  
> -- Joshua
>  
>  
>  
>  
>  
> On 3/10/06 3:37 AM, "Bierens,Gerard G.J.M." <G.Bierens at fontys.nl
> <http://mail.wikipedia.org/mailman/listinfo/mediawiki-l> > wrote:
>  
>> Just like {{CURRENTMONTHNAME}} would give 'March', is it possible to
>> automatically get the previous month?
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> Thanks,
>> 
>> Gerard 
>> 
> 
>  
> 
> 
> 
> ----------------------------------------------------------------
> Op deze e-mail zijn de volgende voorwaarden van toepassing:
> 
> http://www.fontys.nl/disclaimer
> 
> The above disclaimer applies to this e-mail message.
> ----------------------------------------------------------------
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l




More information about the MediaWiki-l mailing list