WikiIndex:Parser functions

WikiIndex - wikis, wiki people, wiki software, and wiki ideas
Jump to: navigation, search

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

This WikiIndex:Parser functions article is a 'stub'. You can help by expanding this stub article, thanks.  :-)

List[edit]

expr[edit]

coming soon.

if[edit]

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, 'The name of this site is WikiIndex.' will show up because value was specified, as 'WikiIndex'. {{ifExample|not WikiIndex}} makes 'The name of this site is not WikiIndex.', because value is specified, as 'not WikiIndex'. {{ifExample}} makes just 'This site has an unknown name.' because it was left blank.

ifeq[edit]

coming soon.

ifexist[edit]

coming soon.

ifexpr[edit]

coming soon.

rel2abs[edit]

coming soon.

switch[edit]

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 "argh

" because a is entered. {{switchExample}} gives "nothing

", because the template was left blank. {{switchExample|d}} gives "nothing

", because d doesn't exist in the template.

time[edit]

coming soon.

See also[edit]