See something you'd like to change or add, but you've never edited an open encyclopædia before? This overview was written to help absolute beginners get started.

Template:1 of 2

From A Storehouse of Knowledge
Jump to: navigation, search



Template: 1 of 2
Use on/in Templates
Use for Simplifying code
Category template applies to page (none)
Template Parameters
(See Template style manual).
Name Purpose Required? SMW property Comment
1 Parameter to return (and Wikilinked) if supplied no
2 Parameter to return if parameter 1 not supplied no
default Value to return if neither supplied no

This template is for use in other templates. It returns parameter 1 if supplied, else parameter 2 if supplied. If neither is supplied, paramater default is returned if supplied, else nothing is returned.

If paramater 1 is supplied, the returned result is automatically Wikilinked.

The template favours the the first parameter. That is, if both parameters are supplied, the first is returned (and Wikilinked) and the second is ignored.

Example of use

An infobox template might call for an optional parameter X, with an alternative of X L. That is, the user has three choices:

  • Pass a value to X to be unlinked.
  • Pass a value to X L to be automatically linked.
  • Pass no value, in which case the corresponding row of the infobox is not to be shown.
In this case, the usage would be:
{{1 of 2 
  | {{{X L|}}} 
  | {{{X|}}}
}}

Combining this with {{t row if}} allows the template to easily choose between the three options:

{{t row if 
  | Title 
  | {{1 of 2 
    | {{{X L|}}} 
    | {{{X|}}}
  }}
}}
Personal tools
Namespaces

Variants
Actions
visitor navigation
contributor navigation
monitoring
Toolbox