Extension:IfTemplates
Jump to navigation
Jump to search
IfTemplates Release status: beta |
|
---|---|
Implementation | Parser function |
Description | Tests if a given page contains only template calls |
Author(s) | Ike Hecht (tosfostalk) |
Latest version | 0.1 (2014-05-22) |
MediaWiki | 1.29+, likely earlier versions as well |
PHP | 5.3+ |
Database changes | No |
License | GPL |
Download | |
Translate the IfTemplates extension if it is available at translatewiki.net | |
The IfTemplates extension adds a parser function that tests if a given page contains only template calls. This can have a number of uses. For example, in your wiki you may be able to make the assumption that any pages that only contain template calls are stubs with no real content.
Installation
- Download and place the file(s) in a directory called
IfTemplates
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'IfTemplates' );
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
The extension's usage is similar to the #ifexist parser function. It takes an input string, interprets it as a page title, and returns one of two values depending on whether or not the page contains only templates.
{{#iftemplates: page title | value if only templates | value if doesn't exist or has non-template text }}
The function evaluates to true
if the page exists & contains only templates.
Otherwise it evaluates to false
.
Note that if the page exists but contains no template calls, it evaluates to false.