Template:C

From Moegirlpedia
Jump to: navigation, search
Template-info.svg Template Documentation  [View] [Edit] [History] [Refresh]

Introduction

This template is a quick cycle counter to anonymize the numeric part of a parameter received by the #forargs parser. So that there is no need to think of the number of the parameter.

  • What is a parameter received by the #forargs parser? Take the family template {{Navbox}} as an example:
{{Navbox
|name = xxx
|titme = xxx

<!-- Here it is. -->
| group1  = 
| list1   = 

| group2  = 
| list2   = 
}}

Usage

1. Initialization

{{c|init=<Set the initial value, required>|time=<Set the cycle, 2 as default>|id=<Set the ID of the counter, required>}}

{{c|init|id=<Counter ID>}}     <!-- init can be written in this form to set 1 as the initial value. -->

A counter must be initialized before use, otherwise it may interact with other counters.

2. Usage

{{c|id=<Counter ID>}}     <!-- If the ID is not filled, it will use the ID passed in the last time the template called. -->
{{c|noecho}}              <!-- This will only add the count without any output. -->

Note:

  • Please consider the nested structure of a template when using several cycle counters.

Example

Example 1

{{c|init|id=test}}

{{c}}{{c}}
{{c}}{{c}}
{{c}}{{c}}


11 22 33

Example 2

{{c|init|id=one}}
{{c|init=2|time=3|id=two}}

{{c|id=one}}{{c}}
{{c}}{{c}}
{{c}}{{c}}

{{c|id=two}}{{c}}
{{c}}{{c}}
{{c}}{{c}}


11 22 33

222 333

See also

  • {{iCounter}} (counter meta template)
  • {{counter}} (mainly for generating unique sequence number)
  • {{c}} (for anonymous #forargs parameter)
  • {{n}} (counters in articles)