Template talk:Qif
From Hattrick
Jump to navigationJump to search
Purpose and Function
- This template does not work at this point. For some reason, which I suspect is the fact that in this wiki the pipe symbol works a bit different from the way it work sin Wikipedia, or that something is missing, it is currently not possible to get this Template working like it should. Could some template expert take a look at this? Other related templates are Template:Show1 and Template:Boolnot. Additional info about [1]. --duno7 16:10, 28 November 2005 (UTC)
- This is an implementation of the "if ... then ... else" behaviour, to be used mostly in other Templates.
- This function has undefined behaviour if parameter test or then is missing, or there are additional parameters defined. Parameter else is optional.
- This is basically the same as the Wikipedia template [2], please check the discussion page on the wikipedia for more information.
Usage
{{qif
|test=VARIABLE_OR_PARAMETER_TO_TEST
|then=code if true or empty
|else=code if true or empty
}}
Example
| Code | Result |
|---|---|
{{qif
|test={{boolnot|true}}
|then=true
|else=false
}}
|
false |
{{qif
|test={{booleq|foo|bar}}
|then=true
|else=false
}}
|
true |
{{qif
|test=
|then=bar
}}
|
|
{{qif
|test=foo
|then=bar
}}
|
Comments
Ok, let's see if this works. It can be useful in some templates (for hiding empty fields, or similar) --duno7 15:24, 28 November 2005 (UTC)