Link

From Shihad Wiki
Revision as of 01:57, 2 March 2008 by Kinopus (talk | contribs)
Jump to: navigation, search

Other languages: Template:ParserFunctions Template:H:h Template:Sspp Template:Shortcut Template:Move Template:Extension

Template:Otheruses4

The MediaWiki extension ParserFunctions is a collection of parser functions (note the difference between the name of the collection, and the general term). These parser functions have a hash character in front of the function name, so they typically have the syntax:

Template:Ft

Functions

The extension defines nine functions: expr, if, ifeq, ifexist, ifexpr, switch, time, rel2abs, and titleparts.


#expr:

#if:

The if function is an if-then-else construct. The condition is always true unless it is empty or whitespace-only. The code in the second argument is parsed if the condition is true, and the third argument is parsed if the condition is false (either or both may be blank, and the code-if-false argument can be omitted entirely).

The condition is evaluated as text, so mathematical expressions will always evaluate as true; to use expressions as conditions, see #ifexpr. It is not possible to distinguish between an undefined parameter in a template and a blank one (it is possible with #ifexpr).

Examples:

#ifeq: