Wikia

Community Central

WatchlistRandom pageRecent changes

Help:Parser functions

Talk0
61,711pages on
this wiki
This extension is enabled by default on Wikia.

Contents

A "parser function" is a template-like construct which returns a value based on at least one unnamed parameter, separated from the function name by a colon ":"; there may be more parameters which, like those of ordinary templates, are each preceded by "|".

Parser functions allow you to use a little bit of programming logic in your templates, including "if" statements and basic calculations.

There are many simple ones that are built into MediaWiki itself. Some extensions also add a few for specific tasks. There is a large collection of commonly used ones by the name of ParserFunctions which Wikia has enabled by default on all wikis. ( StringFunctions, which adds string manipulation functions is now built into the ParserFunctions extension, and thus is also default on all wikis)

Parser functions in actionEdit

You can hide table rows which contain empty parameters by using a variation of:

{{#if: {{{input|}}} | {{!}}-
{{!}} {{{input}}} }}

Produces the following code only if input is defined.

|-
| input

{{!}} is used in the above parser function instead of | as the extension uses | to separate parameters. {{!}} is a template at Template:! which transcludes | into the code after the parser function has been validated.

See alsoEdit

Latest Photos

Add a Photo
7,043photos on this wiki
See more >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki