Template:IfTHEN: Difference between revisions
Jump to navigation
Jump to search
m (Protected "Template:IfTHEN" [edit=sysop:move=sysop]) |
(Added custom return handling) |
||
Line 1: | Line 1: | ||
<includeonly>{{#switch: {{#if:{{{1}}}|{{{1|undefined}}}|empty}}|empty|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{2}}}|{{{2|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{3}}}|{{{3|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{4}}}|{{{4|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{5}}}|{{{5|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{6}}}|{{{6|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{7}}}|{{{7|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{8}}}|{{{8|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{9}}}|{{{9|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|<!--defined-->{{#switch: {{#if:{{{10}}}|{{{10|undefined}}}|empty}}|empty={{#If:{{{false|}}}|{{{false}}}}}|undefined={{#If:{{{true|}}}|{{{true}}}|1}}|{{#If:{{{false|}}}|{{{false}}}}}}}}}}}}}}}}}}}}}}}}}</includeonly> |
|||
<noinclude> |
<noinclude> |
||
==Use== |
==Use== |
||
This template will accept up to 10 variables. If the first variable is true, it will check to see if they are all true, returning "1" if so. It will also return 1 if the first variable is not defined or whitespace. |
This template will accept up to 10 variables. If the first variable is true, it will check to see if they are all true, returning "1" if so. It will also return 1 if the first variable is not defined or whitespace. |
||
If <nowiki>|true= or |false=</nowiki> is set, custom strings will be returned. |
|||
<pre> |
<pre> |
||
{{IfTHEN|variable1|....|variable10}} |
{{IfTHEN|variable1|....|variable10}} |
||
Additional Options: |
|||
|true= |
|||
|false= |
|||
</pre> |
</pre> |
||
[[Category:Templates|{{PAGENAME}}]] |
[[Category:Templates|{{PAGENAME}}]] |
||
[[Category:Templates for Templates|{{PAGENAME}}]] |
[[Category:Templates for Templates|{{PAGENAME}}]] |
||
==Also See:== |
|||
* [[Template:IfAND]] |
|||
* [[Template:IfMatch]] |
|||
* [[Template:IfOR]] |
|||
* [[Template:IfXOR]] |
|||
</noinclude> |
</noinclude> |
||
<includeonly> |
|||
{{#switch: {{#if:{{{1}}}|{{{1|undefined}}}|empty}} |
|||
| empty |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{2}}}|{{{2|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{3}}}|{{{3|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{4}}}|{{{4|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{5}}}|{{{5|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{6}}}|{{{6|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{7}}}|{{{7|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{8}}}|{{{8|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{9}}}|{{{9|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| <!--defined--> {{#switch: {{#if:{{{10}}}|{{{10|undefined}}}|empty}} |
|||
| empty = |
|||
| undefined = 1 |
|||
| 1 |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
}} |
|||
</includeonly> |
Revision as of 14:42, 22 April 2008
Use
This template will accept up to 10 variables. If the first variable is true, it will check to see if they are all true, returning "1" if so. It will also return 1 if the first variable is not defined or whitespace.
If |true= or |false= is set, custom strings will be returned.
{{IfTHEN|variable1|....|variable10}} Additional Options: |true= |false=