Template talk:IfEqualAny

From The Urban Dead Wiki
Jump to navigationJump to search

Documentation

This template allows the use of an "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:

{{IfEqualAny|1=xx|2=xx|3=xx|4=xx|[...]|50=xx}}

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 {{BASEPAGENAME}}, {{{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:
{{IfEqualAny|1={{BASEPAGENAME}}|2=TheTemplateCode|3=TheErrorMessage|4=AllowedPage1|5=AllowedPage2|6=AllowedPage3}}