Help:Parser functions

A "parser function" is a special piece of code in MediaWiki which extends the template functionality to perform logical operations. When rendered, parser functions use the parameters included in the definition to print out a specific result.

Parser functions are written out the same way templates are, surrounded by curly brackets. They are most easily identified by having either a colon or a hash sign (#) in the function name (or both, as is in the case of the  function).

A list of all parser functions for use on a wikia is visible at Special:Version.

Step-by-step use
Below this step-by-step is extra information with links to help direct you to full-fledged documentation of each parser function. In this step-by-step guide, we will be using the  (if expression) parser function, which is enabled on each Wikia wikia by default. Its syntax is:     In the example above, we filled in the mathematical expression (1 > 0), set the function to say "yes" if 1 > 0 is mathematically correct and say "no" if 1 > 0 is mathematically incorrect.   → . Note what would have happened if we had tweaked the expression but kept the returned values the same. The equation proves false because 0 is not greater than 1 and "no" is returned.   → .
 * 1) Identify the parser function that is appropriate for the task you are trying to do. There are a wide variety of parser functions, so be sure to do your research.
 * 1) Identify the proper syntax for the parser function you wish to use.
 * 1) Fill in the syntax.
 * 1) Save the page and verify that the function seems to be returning the expected value. In our example, "yes" should be returned because 1 is indeed greater than 0.

While the above example might seem silly, because one should always know 1 > 0, the power of the parser function is revealed when it is passed a parameter. Let's say you are designing an infobox for a wikia about a TV show. You want to include a character's age and determine if they are an adult or not.

If within the infobox you have, the code would say "This character is an adult" if the given age of the character is at or above 18. If the given age was less than 18, the code would instead say "this character is not an adult."

Built-in MediaWiki parser functions
The MediaWiki software itself includes multiple parser functions at the core. A full list of these are available here on MediaWiki.org. This page will illustrate the most useful.


 * Returns the full URL of a given page.
 * Returns the full URL of a given page.


 * Converts a language code to the language name.
 * Converts a language code to the language name.


 * Makes a string lowercase (opposite of ).
 * → case
 * → case


 * Takes a namespace number and tells you what the namespace is.
 * Takes a namespace number and tells you what the namespace is.


 * If a given expression equals one, returns the singular value given. If a given expression equals two, returns the plural value given.
 * → 1 is
 * → 2 iss
 * → 2 iss

ParserFunctions Extension
The ParserFunctions extension is a popular MediaWiki extension that added a number of useful parser functions on top of the MediaWiki ones listed above. This extension is enabled by default across all of Wikia. This extension also include most of the parser functions found in the now deprecated extension StringFunctions, most notably  .

The ParserFunctions extension has functions for mathematical operations, if/else statements, and time functions. To view a complete list of these functions and extremely useful documentation on how to use them, please visit the extension's official help page.

Other Extensions
Quite a few other extensions that are popular on Wikia add some parser functions. Here are some common ones.


 * Arrays - adds , , .
 * Semantic MediaWiki - adds , , .
 * Semantic Forms - adds , , 
 * Simple Calendar - adds  </tt>
 * Variables - adds , , </tt>.

So if an extension you are interested in has a parser function included, please consult that extensions page on MediaWiki.org.

Further help and feedback
de:Hilfe:Parser-Funktionen fr:Aide:Fonctions parseur ja:Help:パーサ関数 pl:Pomoc:Funkcje parsera zh:help:Parser 功能