User:Ericb/If

From MHWiki
< User:Ericb
Revision as of 00:48, 26 October 2011 by Ericb (talk | contribs) (link to live version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page was my playground before creating Template:If

A conditional template. The first argument cannot start with "=". If the first argument contains any text, then this ends up calling the {{Use}} template with two arguments, one named "use" with the original second argument as its value, and the other will have an unrelated name, so the overall expansion is the one use of the name "use" - the second argument. But if the first argument is empty (or missing), then this ends up using the {{Use}} template with use= specified twice, and the last use wins, giving the overall expansion of the third argument.

That is, this template is an alternative implementation of {{#if:test|if text|if empty}}, with a slightly different syntax:
{{if|test|if text|if empty}}