WikiIndex:Parser functions

From WikiIndex
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

This WikiIndex:Parser functions article is a WikiIndex 'stub'. If you are familiar with, and understand the WikiIndex policy system, you can help by expanding this WikiIndex stub article, thanks.  :-)

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 if example. If {{if example|WikiIndex}} is entered, 'The name of this site is WikiIndex.' will show up because value was specified, as 'WikiIndex'. {{if example|not WikiIndex}} makes 'The name of this site is not WikiIndex.', because value is specified, as 'not WikiIndex'. {{if example}} makes just 'This site has an unknown name.' 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 switch example. {{switch example|a}} gives 'argh' because a is entered. {{switch example}} gives 'nothing', because the template was left blank. {{switch example|d}} gives 'nothing', because d doesn't exist in the template.

time

coming soon.

See also