Extension:HasCategory
From MediaWiki.org
|
Release status: beta |
|||
|---|---|---|---|
| Implementation | Parser function | ||
| Description | Enhances parser with ability to find out whether a page is contained within a category with the {{#ifhascat:}} parser function. | ||
| Author(s) | Matěj GrabovskýTalk | ||
| Last Version | 0.10 (2009-09-02) | ||
| MediaWiki | 1.15 | ||
| License | GPL 2.0 or later | ||
| Download | /Code | ||
|
|||
|
check usage (experimental) |
|||
HasCategory enhances MediaWiki parser with new function which determines whether a page has a certain category and based on result returns specified value.
[edit] Usage
Syntax for the {{#ifhascat:}} parser function:
{{ #ifhascat: page | category | then | else }}
The third (then) and fourth (else) parameters are optional, their defaults are 1, respectively 0.
[edit] Download instructions
Copy and paste the code from this page and place it in $IP/extensions/HasCategory/HasCategory.php, HasCategory.i18n.php, and HasCategory.i18n.magic.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following code to your LocalSettings.php:
# HasCategory extension require_once( "$IP/extensions/HasCategory/HasCategory.php" );