Template talk:Switch
From The Urban Dead Wiki
Jump to navigationJump to search
Used to extend a variable as a parameter while maintaining a default value, allowing the selection of one of many predetermined values.
Example 1
Used alone:
{{switch |{{CURRENTDOW}} |case: 1=Mon |case: 2=Tue |case: 3=Wed |case: 4=Thu |case: 5=Fri |case: 6=Sat |case: 0=Sun |default=No date }}
Returns the abbreviated form of the current day. The name of today may be abbreviated as, Thu.
Example 2
Used inside a template in conjuction with another variable:
Sample content for {{mytemplate}}
... width: {{switch|{{{width}}}|case: big=500px|case: small=100px|default={{{width|250px}}} }}; ...
{{mytemplate}} outputs ... width: 250px; ...
{{mytemplate|width=big}} outputs ... width: 500px; ...
{{mytemplate|width=small}} outputs ... width: 100px; ...
{{mytemplate|width=86px}} outputs ... width: 86px; ...