FANDOM


Parser Functions (More Info)

#if {{#if: test string | value if test string is not empty | value if test string is empty (or only white space) }}
#ifeq {{#ifeq: string 1 | string 2 | value if identical | value if different }}
#iferror {{#iferror: test string | value if error | value if correct }}
#ifexpr {{#ifexpr: expression | value if true | value if false }}
#ifexist {{#ifexist: page title | value if exists | value if doesn't exist }}
#switch
{{#switch: comparison string
| case = result
| case = result
| case = result
| #default = default result
}}
{{#switch: comparison string
| case | case = result1
| case | case | case = result2
| case = result3
| default result
}}
#expr {{#expr: expression }}

Rounding

{{#expr: (100.5) round 0}} = 101
{{#expr: (100.245) round 2}} = 100.25
{{#expr: (1234.245) round -2}} = 1200
{{#expr: ceil(1.4)}} = 2
{{#expr: floor(1.6)}} = 1

String Functions (More Info)

#replace (Returns the given string with all occurrences of a search term replaced with a replacement term {{#replace: string | search term | replacement term }}
#explode (Splits a string into pieces and returns one piece) {{#explode: string | delimiter | position }}
#len (Returns the number of characters in the string) {{#len: string }}
#pos (Returns the position of a given search term within the string) {{#pos: string | search term | offset }}
#rpos (Returns the last position of a given search term within the string) {{#rpos: string | search term }}
#sub (Returns a substring from a given string) {{#sub: string | start | length }}

Formatting (More Info)

formatnum (adds thousands separators to a number) {{formatnum: Number/MW Function Equaling a Number }}

Reverse the Process:

{{formatnum: Number/MW Function Equaling a Number | R }}

lc (change all letters to lowercase) {{lc: string }}
lcfirst (change first letter to lowercase) {{lcfirst: string }}
uc (change all letters to uppercase) {{uc: string }}
ucfirst (change first letter to uppercase) {{ucfirst: string }}

Variables (More Info)

#vardefine (assigns a variable without printing it) {{#vardefine: variable name | specified value }}
#vardefineecho (assigns a variable and prints it) {{#vardefineecho: variable name | specified value }}
#var (calls a variable) {{#var: variable name}}
#varexists (returns 1 if the variable is already defined (also when the value is a void string). If the variable is not defined the return value is void.) {{#varexists: variable name}}

Loops (More Info)

#loop
{{#loop: variable name
| starting value
| number of loops to be performed
| wiki markup
}}

After each loop, the variable is incremented by one if <number of loops to be performed> is positive, or decremented by one if <number of loops to be performed> is negative.

#while
{{#while:
| condition text that ends loop when it equates to whitespace
| block statement
}}

Basics

Use a Template Parameter {{{ name or number | value if parameter is not called }}}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.