Template:IfMatch: Difference between revisions

From Elanthipedia
Jump to navigation Jump to search
(Add custom error messages)
mNo edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if:{{#pos:{{lc:{{{2}}}+{{{3}}}+{{{4}}}+{{{5}}}+{{{6}}}+{{{7}}}+{{{8}}}+{{{9}}}+{{{10}}}+{{{11}}}}}|{{lc:{{{1}}}}}}}|{{#If:{{{true|}}}|{{{true}}}|1}}|{{#If:{{{false|}}}|{{{false}}}}}}}</includeonly><noinclude>
<includeonly>
{{essential}}
{{#switch: {{lc:{{{1}}} }}
|{{lc:{{{2}}}}}
|{{lc:{{{3}}}}}
|{{lc:{{{4}}}}}
|{{lc:{{{5}}}}}
|{{lc:{{{6}}}}}
|{{lc:{{{7}}}}}
|{{lc:{{{8}}}}}
|{{lc:{{{9}}}}}
|{{lc:{{{10}}}}}
|{{lc:{{{11}}}}} = 1
|{{#If:{{{error|}}}
|{{{error}}}
}}

}}
</includeonly>
<noinclude>
==Usage Documentation==
==Usage Documentation==
This template will accept one variable which it will compare to up to 10 other variables. If any of them match the first, it will return "1".<br>
This template will accept one variable which it will compare to the second variable. If the first part is present in the second one, it will return "1". This allows loading of a delimited string of variables and comparing them to a single variable.<br />
It will accept up to 10 other values in order to remain backward compatable.<br />
<b>Note:</b> The match is case insensitive.
<b>Note:</b> The match is case insensitive.


By specifying <nowiki>|error=</nowiki> a custom error message may be returned on no match.
By specifying <nowiki>|true= and |false=</nowiki> a custom strings may be returned on match and no match.
==Syntax==
==Syntax==
<pre>
<pre>
{{IfMatch | matchstring | variable1 | variable2 | .... | variable10}}
{{IfMatch | matchstring | string}}


Additional options:
Additional options:
|error=
|true=
|false=
</pre>
</pre>

[[Category:Templates|{{PAGENAME}}]]
==Also See==
[[Category:Templates for Templates|{{PAGENAME}}]]
* [[Template:IfMatch2]]
* [[Template:IfAND]]
* [[Template:IfTHEN]]
{{Cat|Templates,Templates for Templates}}
</noinclude>
</noinclude>

Latest revision as of 10:04, 29 June 2014

Essential Template
  • This template is so essential that it has been protected to prevent tampering.
  • If you have suggestions to extend its function or have observed bugs, please post to the discussion page.


Usage Documentation

This template will accept one variable which it will compare to the second variable. If the first part is present in the second one, it will return "1". This allows loading of a delimited string of variables and comparing them to a single variable.
It will accept up to 10 other values in order to remain backward compatable.
Note: The match is case insensitive.

By specifying |true= and |false= a custom strings may be returned on match and no match.

Syntax

{{IfMatch | matchstring | string}}

Additional options:
|true=
|false=

Also See