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

Rick DeNatale rick.denatale at gmail.com
Wed Mar 15 22:27:20 UTC 2006


On 3/15/06, Joshua Yeidel <yeidel at wsu.edu> wrote:
> 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.

I do something similar on my wiki to provide an on-this-date feature
on the home page.  I've got a family of history templates with a
master which has 366 template subpages for each day of the year.

Adapting what I do to get a last month template would look something like this:

1st make a template called say LastMonth
Template:LastMonth
{{LastMonth/{{CURRENTMONTHNAME}}}}

Then make 12 templates

Template:LastMonth/January
December

Template:LastMonth/February
January

...

Template:LastMonth/December
November

voila!


--
Rick DeNatale

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/



More information about the MediaWiki-l mailing list