Extension:Autoincrement

From MediaWiki.org

Jump to: navigation, search

           

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Autoincrement

Release status: stable

Implementation  Parser extension
Description A variable hook that adds an autoincrementing variable, {{AUTOINCREMENT}}
Author(s)  Ævar Arnfjörð Bjarmason
Last Version  2008-01-31 (2008-01-31)
MediaWiki  1.12a
License No license specified
Download Download snapshot

Subversion [Help]
Browse source code

check usage (experimental)

[edit] Description

A variable hook that adds an autoincrementing variable, {{AUTOINCREMENT}}. Each time the hook is used on a page it will return a number increased by one from the last use.

[edit] Purpose and usage

This template can be used to aid in constructing complex templates, keep track of the number of entries in a table, or any other place you need an incrementing variable, especially in conjunction with ParserFunctions.

Wiki Markup Result
{{AUTOINCREMENT}}, {{AUTOINCREMENT}}, {{AUTOINCREMENT}} 1, 2, 3

{|
| Dog
|-{{AUTOINCREMENT}}
| Cat
|-{{AUTOINCREMENT}}
| Bird
|-{{AUTOINCREMENT}}
|}
There are {{#expr:{{AUTOINCREMENT}}-1}} animals listed in the table above.

Dog
Cat
Bird

There are 3 animals listed in the table above.

[edit] Installation

To install this, download the latest snapshot and extract it to your extensions directory, the add a line to your LocalSettings.php like

require_once( "$IP/extensions/Autoincrement/Autoincrement.php" );