[Mediawiki-l] Comments and Parameters on Templates

Jean-Marc van Leerdam j.m.van.leerdam at gmail.com
Wed Dec 2 07:11:11 UTC 2009


Hi Rodney,

2009/12/2 Rodney Morris <lucifer at infernaldreams.com>:
> I've two issues I've been bashing my head against for the last few days
> and finally decided to put it out to the list as a whole.  I'm working
> on an increasingly complex template and I'm hoping you guys might be
> able to provide some easy answers.
>
> 1) Is it possible to put comments into a template?  Something that will
> only show up on the edit screen for the template, not on the 'view' tab
> and not when the template is used?
>

Try wrapping the comments in <includeonly><noinclude></noinclude></includeonly>

> 2) Is it possible to assign a parameter value to a parameter within the
> template?  Basically, what I'm trying to do is to use an ifeq statement
> to provide output based on one of three possible parameter values.  For
> example:
>
> Let's assume the only parameter passed from the calling page is a value
> for "pet".  The two values expected are "dog" or "fish".  If the
> parameter value passed is "dog", then I'd want to assign breathes=air,
> legs=4 and teeth=yes.  If the parameter value from 'pet' is "fish", I'd
> want breathes=water, legs=0 and teeth=none.  Later on in the same
> template, I'd want to put the values for breathers, legs and teeth into
> a table.
>
> Now I know I could just put the ifeq statement within the cell in the
> table, but that's going to quickly get repetitive and cumbersome,
> resulting in a vary nasty and complex page under the 'edit' tab.  I'm
> hoping for something a bit more elegant and efficient.
>

Create a 'public' interface template that accepts pet parameter and
then calls the actual technical template that uses the breathes, legs
and teeth parameters (in addition to the pet parameter)

-- 
Regards,

Jean-Marc
--
.       ___
.  @@  // \\      "De Chelonian Mobile"
. (_,\/ \_/ \     TortoiseSVN
.   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
.   /_/   \_\     http://tortoisesvn.net



More information about the MediaWiki-l mailing list