Difference between revisions of "Template:IfEqualAny"

From The Urban Dead Wiki
Jump to navigationJump to search
(New)
 
(Seeing if this fixes a problem I've discovered)
 
(5 intermediate revisions by 3 users not shown)
Line 47: Line 47:
|case: {{{49}}}={{{2}}}
|case: {{{49}}}={{{2}}}
|case: {{{50}}}={{{2}}}
|case: {{{50}}}={{{2}}}
|default={{{3}}}}}<noinclude>
|default={{{3}}}}}<noinclude>{{Doc}}[[Category:If Templates|If Equal Any]]</noinclude>
----
=== Documentation ===
This template allows the use of a "if equal any" option. If variable 1 matches any of the variables 4-50, result 2 is shown. If it does not, result 3 is displayed.
 
To use this template, you can use the following code, of course replacing xx with the appropriate content:
 
<code><nowiki>{{IfEqualAny|1=xx|2=xx|3=xx|4=xx|[...]|50=xx}}</nowiki></code>
 
If {{{1}}} matches anything of {{{4}}}-{{{50}}}, {{{2}}} is returned. If it does not, {{{3}}} is returned.
 
==== Usage Example ====
A possible scenario for using this is when a template should only be shown on specific pages, i. e. display an error message when included on pages that have not been authorized. {{{1}}} could be <nowiki>{{BASEPAGENAME}}</nowiki>, {{{2}}} would be the template's code, {{{3}}} the error message, and {{{4}}} to {{{50}}} the allowed pages (let's assume there are three of them). This is what it could look like:<br /><code><nowiki>{{IfEqualAny|1={{BASEPAGENAME}}|2=TheTemplateCode|3=TheErrorMessage|4=AllowedPage1|5=AllowedPage2|6=AllowedPage3}}</nowiki></code>
 
[[Category:If Templates|Equal Any]]</noinclude>

Latest revision as of 22:37, 25 September 2013

{{{3}}}

Documentation
See the talk page for details.