WikiIndex:Parser functions: Difference between revisions

From WikiIndex
Jump to navigation Jump to search
m (cats)
Line 1: Line 1:
'''ParserFunction''' is a special kind of [[WikiIndex:Magic words|magic word]] that is most useful for templates.
A '''ParserFunction''' is a special kind of [[WikiIndex:Magic Words|magic word]] that is most useful for [[:Category:Templates|templates]].
__NOTOC__
__NOTOC__
==List==
==List==
Line 51: Line 51:
==See also==
==See also==
*[[meta-wiki:ParserFunctions|ParserFunctions]] at [[Meta-Wiki]]
*[[meta-wiki:ParserFunctions|ParserFunctions]] at [[Meta-Wiki]]
[[Category:WikiIndex]]
[[Category:Help]]

Revision as of 21:22, 7 January 2012

A ParserFunction is a special kind of magic word that is most useful for templates.

List

expr

coming soon.

if

Shows different values when entered.
Code:

{{ #if: {{{value|}}} | what to show if activated | what to show if not }}

Example:

{{ #if: {{{1|}}} | The name of this site is {{{1}}}. | This site has an unknown name. }}

Let's say this is included in the template ifExample. If {{ifExample|WikiIndex}} is entered, "Template:IfExample" will show up because value was specified, as "WikiIndex". {{ifExample|not WikiIndex}} makes "Template:IfExample", because value is specified, as "not WikiIndex". {{ifExample}} makes just "Template:IfExample" because it was left blank.

ifeq

coming soon.

ifexist

coming soon.

ifexpr

coming soon.

rel2abs

coming soon.

switch

Compares values.
Code:

{{ #switch: value 
| value1 = what to show if value1 is entered 
| value2 = what to show if value2 is entered 
| | what to show if something else is entered 
| #default = what to show if nothing is entered 
}}

Example:

{{ #switch: {{{1}}} 
| a = argh 
| b = blah 
| c = cough 
| | anything 
| #default = nothing 
}}

This is included in the template switchExample. {{switchExample|a}} gives "Template:SwitchExample" because a is entered. {{switchExample}} gives "Template:SwitchExample", because the template was left blank. {{switchExample|d}} gives "Template:SwitchExample", because d doesn't exist in the template.

time

coming soon.

See also