Extension:CategoryTests
From MediaWiki.org
|
Release status: stable |
|||
|---|---|---|---|
| Implementation | Parser function | ||
| Description | Functions for category testing | ||
| Author(s) | Ryan Schmidt (SkizzerzTalk) | ||
| Last Version | 1.4 | ||
| MediaWiki | 1.11+ | ||
| License | GPL | ||
| Download | Download snapshot |
||
|
|||
|
check usage (experimental) |
|||
Contents |
[edit] Usage
This currently defines 3 parser functions for category testing.
{{#ifcategory:category|then|else|page}}-- tests if the given page is in the category given, then displays "then" or "else" (or current page if no page is given).{{#ifnocategories:then|else|page}}-- tests if the given page does not belong in any categories, then displays "then" or "else" (or current page if no page is given).{{#switchcategory:category1=result1|category2=result2|...|default}}-- Operates like the ParserFunctions#switch, but doesn't take an initial parameter (it just starts cycling through right away) and tests if the page is in those categories instead of comparing it to a value. You can specify to test other pages using#page=pagename, where it would then test that page instead of the current page until the next#pagedefinition, in which case it will test that page now instead. Making#pageempty resets it to the current page. If your default case needs an equals sign, you may use#defaultto declare it.
[edit] Download instructions
Download the latest snapshot of this extension via the MediaWiki Extension Distributor. Then, extract the files to your MediaWiki's extensions directory (a new directory at extensions/CategoryTests will be formed).
Warning: Before you download read Requirements or you might install the wrong version.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
require_once("$IP/extensions/CategoryTests/CategoryTests.php");
[edit] Requirements
This extension currently requires MediaWiki versions 1.11 or higher. When downloading, always download the development version (trunk) version of this extension!