PhantomWiki:Extensions Installed/Autoincrement

From PhantomWiki
Jump to: navigation, search

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.

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.