Help:Functions
From QED
| Help |
|
| Related topics |
MediaWiki's template mechanism is used to provide a variety of predefined functions and also allows anyone with editing privileges in the Template: namespace to define additional functions.
Contents |
Colon Functions
A colon function, also called a parser function, computes a value based on the specified paramters. There are many predefined colon functions, such as subst: for inline substitution of a template.
One particularly useful colon function is fullurl:, e.g.:
{{fullurl:Special:Prefixindex|namespace=12&from=}}
produces: http://qed.princeton.edu/index.php?title=Special:Prefixindex&namespace=12&from=
For further details, see Help:Parser function.
Home-grown Colon Functions
These are the locally defined colon functions:
- {{imageURL:filename}} generates the full URL for the specified image specified as a filename
For example, [{{imageURL:ImageOf.png}}] produces: [1]
Note: {{filepath:filename}} has a similar use, but produces nothing if the specified filename has not been uploaded.
Example: [{{filepath:ImageOf.png}}] produces: [2]
Arithmetic and Logical Calculations
Various colon functions are provided for evaluating arithmetic and logical expressions:
- #expr:
- #if:
- #ifexpr:
- #ifeq:
- #switch:
See Help:Calculation












