Extension:CategoryFunctions

What can this extension do?
This extension can be used to display text depending on whether a page is in a given category or not.



Usage
The first function should be quite clear: It tests if SomePage is in SomeCategory. If yes, it outputs ✘, otherwise &amp;nbsp;.

The second function could be expressed using the first, but it is provided for convenience and speed, as it makes queries for lots of categories faster and easier. The parameters are a bit switched:
 * The first is again the pagename.
 * The second is the separator between the different return values.
 * The third parameter is the query list + associated return values. It is split first at the ";" into different queries; each part is then split at the ",". All but the last parts are names of categories and the last part is returned in case the page is in one category.
 * Finally, the last parameter is the value that is inserted in case the page is not in a given category.

An example:

We take again the query. Assume that SomePage belongs to categories 9-12M, 13-15M and 13-15J. Then the parser function returns the following value: &amp;nbsp;||✘||✘||&amp;nbsp;.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php: