Help:Parser functions in templates

From NLSC Wiki
Jump to: navigation, search

When applying ParserFunctions to template parameters, a pipe symbol ("|") may be used to provide the empty string as default value, in order to indicate how to handle things if a parameter is or is not passed in.

  • {{{1}}}
Sample
{{#if: {{{1}}} | will process this section if parameter 1 is non-empty or not specified | will process this section if parameter 1 is a null/empty string or a breaking space.)}}
Result
will process this section if parameter 1 is non-empty or not specified
  • {{{1|}}}
Sample
{{#if: {{{1|}}} | will process this section if there is a parameter 1 | will process this section if there is no parameter 1, or if it is a null/empty string or a breaking space.}}
Result
will process this section if there is no parameter 1, or if it is a null/empty string or a breaking space.

The second usage ({{{1|}}}) is more common, and often the desired way to handle situations where a parameter exists, but is comprised only of empty space.

[edit] See also

Personal tools
Namespaces
Variants
Actions
Navigation
Guides & Info
Games
Series
Toolbox