Difference between revisions of "Template:N"
(Transport form zh.moegirl.org.cn) |
m |
||
Line 6: | Line 6: | ||
|{{iCounter|{{{id|{{#var:n.idSave}}}}}|++}} | |{{iCounter|{{{id|{{#var:n.idSave}}}}}|++}} | ||
}}{{#ifeq:{{{1|}}}|noecho||{{iCounter|get|{{{id|{{#var:n.idSave}}}}}}}}}<!-- | }}{{#ifeq:{{{1|}}}|noecho||{{iCounter|get|{{{id|{{#var:n.idSave}}}}}}}}}<!-- | ||
− | --></includeonly><noinclude>{{doc}}</noinclude> | + | --></includeonly><noinclude>{{doc}}[[Category:Auxiliary templates]]</noinclude> |
Latest revision as of 09:38, 10 January 2021
Introduction
This template is a self incrementing counter.
It is better not to use this template in function templates, otherwise it may cause confusion in the counter id saved by this template.
Please refer to {{counter}} or {{iCounter}} for template counters.
Usage
1. Initialization
{{n|init=1|id=an id, unique, "n.default" as default}} {{n|init}} <!-- This form with default value 1 -->
Must be initialized before use, the initialization will output the passed value of parameter "init".
2. Using
{{n|id=counter id, last called id as default; if omitted id when initializing, "n.default" as default}} {{n|noecho}} <!-- Increase the count without output -->
Examples
Example 1
{{n|init}} {{n}} {{n}} {{n|init=10}} {{n}} {{n}}
1 2 3
10 11 12
Example 2
{{n|init=100|id=hundred}} {{n}} {{n}} {{n|init|id=one}} {{n}} {{n}} {{n|id=hundred}} {{n}} {{n}}
100 101 102
1 2 3
103 104 105