Template talk:Switch

From The Urban Dead Wiki
Revision as of 05:55, 21 July 2012 by Klexur (talk | contribs) (Undo revision 2013528 by AXE HACK IS AN THAT BLOCKS (talk))
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 abreviated form of the current day. The name of today may be abreviated as , Fri.

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; ...