Template talk:Switch

From The Urban Dead Wiki
Revision as of 19:56, 22 January 2014 by Spiderzed (talk | contribs) (Reverted edits by N O T R E D N A G (talk) to last revision by Klexur)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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:

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