Community Central
Community Central

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. Wikia includes an extension called ParserFunctions on all wikis to allow this.

Parser functions in action

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 also