[Mediawiki-l] About New version

Joshua Yeidel yeidel at wsu.edu
Thu Oct 13 00:06:43 UTC 2005


I don't think it's a bug.  "If" merely takes advantage of the fact that
"multiple assignments of values to the same parameter in the same template
call are allowed and result in the last value being used."

[From 
http://meta.wikimedia.org/wiki/Help:Template_names%2C_variable_names_and_par
ameters_depending_on_a_variable_or_parameter#A_parameter_name_depending_on_a
_parameter]

"If" works by passing to another template a parameter name as well as a
parameter value based on the value of a parameter passed to it.

[If this makes your head hurt, join the club! <grin>]

Here's a step-by-step:

"If" takes three parameters:  the "test" value {{{1}}}, the
"do-if-test-not-empty" value {{{2}}}, and the "do-if-test-is-empty" value
{{{3}}}.

"If" contains a call to "if2".  The call's first parameter assignment sets
an unnamed parameter to the "do-if-test-not-empty"  value.  The parameter is
automatically given the name "1".  Then there is a second parameter
assignment.  The name of the parameter in this assignment is "1" plus the
test value.  If the test value is empty, the name of the parameter is just
"1", and this assignment overrides the first assignment, setting parameter
"1" to the "do-if-test-is-empty" value.

If the test value is not empty, the parameter name in the second assignment
is "1xxxxxxx" or whatever, and no override takes place.

"If2" just takes the value of the parameter named "1" passed to it and
echoes it.  If2 ignores all other parameters.

The following equivalent code may be a little clearer:

    {{if2|1={{{2}}}|1{{{1}}}={{{3}}}}}

HTH,

-- Joshua






On 10/12/05 2:05 PM, "Rob Church" <robchur at gmail.com> wrote:

> Isn't this the template that Kate said works because of a pug in the
> software, and which should be phased out of use because that pug will
> likely be removed in later versions?
> 
> 
> Rob Church
> 
> On 12/10/05, Emilien ARNAUD <emilien at creatixea.com> wrote:
>> I don't understand  the code signification:
>> 
>> {{if2|{{{2}}}|1{{{1}}}={{{3}}}}} could be translated in words by:
>> 
>> $if2_1 means {{{1}}} for the If2 template
>> $if2_(1$if_1) means 1{{{1}}} for the if2 template
>> 
>> "Inserting the if2 template in if1, associating $if2_1 = $if_2,
>> $if2_(1$if_1) = $if_3"
>> But
>> If2 is only equal to {{{1}}} means only equal to $if2_1
>> 
>> Is something clear as explanation ??? lol
>> 
>> -----Message d'origine-----
>> De : mediawiki-l-bounces at Wikimedia.org
>> [mailto:mediawiki-l-bounces at Wikimedia.org] De la part de Joshua Yeidel
>> Envoyé : mercredi 12 octobre 2005 18:53
>> À : mediawiki list
>> Objet : Re: [Mediawiki-l] About New version
>> 
>> "If" is a  Wikipedia template (and a pretty cool one, at that).  Go to
>> 
>> http://en.wikipedia.org/w/index.php?title=Template:If&action=edit
>> 
>> To view it.  [Don't be fooled by its appearance on the "Template" tab;  you
>> must view the source on the "edit" page to see the real thing.]
>> 
>> Copy and paste the source into your own Template:If page.
>> 
>> Also be sure to read the "discussion" page for Wikipedia's Template:If.
>> 
>> -- Joshua
>> 
>> 
>> 
>> On 10/12/05 12:35 AM, "Emilien ARNAUD" <emilien at creatixea.com> wrote:
>> 
>>> Hi, I installed the 1.5.0 version.
>>> Does the {{{if:variable|hello world}}} function works ? If not, is
>>> there any way to enable / activate it. If not does anyone wrote
>>> something to implement that ?
>>> 
>>> Thanks in advance for your answer,
>>> Sincerely,
>>> 
>>> CreatixEA
>>> _______________________________________________
>>> MediaWiki-l mailing list
>>> MediaWiki-l at Wikimedia.org
>>> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>> 
>> _______________________________________________
>> MediaWiki-l mailing list
>> MediaWiki-l at Wikimedia.org
>> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>> 
>> _______________________________________________
>> MediaWiki-l mailing list
>> MediaWiki-l at Wikimedia.org
>> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>> 
> _______________________________________________
> 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