How to Use Parser Functions in MediaWiki

The parser function if displays results depending on whether what you put for y is blank, or contains character(s)., ifeq displays results depending on whether or not y and z are the same things., switch is basically a more extended and versatile...

5 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: The parser function if displays results depending on whether what you put for y is blank

    While you can put anything instead of a parameter, it won't have much use.

    Replace y with what parameter you want to check.

    Replace z with what you want to appear if y is supplied.

    Replace a with what you want to appear if y isn't supplied.
  2. Step 2: or contains character(s).

    As with #if:, this parser function is most helpful when used with parameters rather than plain text.

    Replace y and z with what strings/parameters you want to compare.

    Replace a with what you want to appear if y and z are the same.

    Replace b with what you want to appear if y and z aren't the same. , {{ #switch: y | a=b | c=d | e=f }} Replace a, c, e, etc. with what result you want to appear if what you supply for y.

    Replace b, d, f, etc. with what you want to appear if y happens to equal a, c, e, and so on. , This parser function can be pretty handy with parameters and magic words at times. {{ #expr: y }} Replace y with the math problem you want to solve.
  3. Step 3: ifeq displays results depending on whether or not y and z are the same things.

  4. Step 4: switch is basically a more extended and versatile version of the parser function #ifeq.

  5. Step 5: expr basically does math expressions.

Detailed Guide

While you can put anything instead of a parameter, it won't have much use.

Replace y with what parameter you want to check.

Replace z with what you want to appear if y is supplied.

Replace a with what you want to appear if y isn't supplied.

As with #if:, this parser function is most helpful when used with parameters rather than plain text.

Replace y and z with what strings/parameters you want to compare.

Replace a with what you want to appear if y and z are the same.

Replace b with what you want to appear if y and z aren't the same. , {{ #switch: y | a=b | c=d | e=f }} Replace a, c, e, etc. with what result you want to appear if what you supply for y.

Replace b, d, f, etc. with what you want to appear if y happens to equal a, c, e, and so on. , This parser function can be pretty handy with parameters and magic words at times. {{ #expr: y }} Replace y with the math problem you want to solve.

About the Author

J

Jason Powell

Committed to making practical skills accessible and understandable for everyone.

48 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: