Template:vcount
From Homestar Runner Wiki
(trying to "physically" separate hcount and vcount, it seems when together they are counted as a single entity) |
(clarify documentation a little.) |
||
(includes 2 intermediate revisions) | |||
Line 1: | Line 1: | ||
- | {{hcount|{{{1}}}}} {{#count:{{{1}}}_visible|{{{2|1}}}}}<noinclude> | + | {{hcount|{{{1}}}|{{{2|1}}}}} {{#count:{{{1}}}_visible|{{{2|1}}}}}<noinclude> |
---- | ---- | ||
Template that augments the [[HRWiki:Counter|counter parser function]] so that its output can be part of a [[HRW:SORT|sorted table]]. This template creates both a '''''hidden counter''''' (for correct sorting) and a '''''visible counter''''' for display. | Template that augments the [[HRWiki:Counter|counter parser function]] so that its output can be part of a [[HRW:SORT|sorted table]]. This template creates both a '''''hidden counter''''' (for correct sorting) and a '''''visible counter''''' for display. | ||
Line 5: | Line 5: | ||
'''Usage:''' | '''Usage:''' | ||
:<code><nowiki>{{ </nowiki> vcount | ''countername'' }}</code> | :<code><nowiki>{{ </nowiki> vcount | ''countername'' }}</code> | ||
- | where ''countername'' is the name of the counter being used. '''''This parameter is required.''''' Place this template in each cell of a given column. | + | where ''countername'' is the name of the counter being used. '''''This parameter is required.''''' Place this template in each cell of a given column. You can specify custom increment values for the counter (''note that brackets denote optional parameters''): |
:<code><nowiki>{{ </nowiki> vcount | ''countername'' [ | ''increment'' ] }}</code> | :<code><nowiki>{{ </nowiki> vcount | ''countername'' [ | ''increment'' ] }}</code> | ||
Line 11: | Line 11: | ||
'''IMPORTANT:''' | '''IMPORTANT:''' | ||
- | Please be sure to first reset the counter before making any calls to this template in order to | + | Please be sure to first reset the counter using the {{tl|hresetcount}} template before making any calls to this template in order for this process to work correctly. Under the hood, this template also uses {{t|hcount}}. But here, two separate counters are initialized: a visible and a hidden counter. These values are incremented in lockstep, but the hidden counter is offset by 10,000 relative to the visible counter. Similarly, up to 6 pairs of counters may be initialized. See that template for more information. |
- | + | ||
- | + | ||
- | + | ||
Optionally, you may set the initial visible counter value to something other than the default value of 1: | Optionally, you may set the initial visible counter value to something other than the default value of 1: | ||
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' | vv=25 }}</code> | :<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' | vv=25 }}</code> | ||
- | This resets the visible counter to 25 | + | This resets the visible counter to 25 but the hidden counter is still initialized to 10,000. You can set the hidden counter value to something other than the default value of 10,000 and count by something other than the default value of 1 in the same call. |
- | :<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' | v= | + | :<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' | v=9999 | vv=100 | countby=-1 }}</code> |
- | This resets the hidden counter to a value of | + | This resets the hidden counter to a value of 9,999 and the visible counter to a value of 100 (once the proper increment of -1 is applied when calling the template). Subsequent calls to this template will continue to decrease ''both'' counters by 1. |
'''Technical Information:''' | '''Technical Information:''' |
Current revision as of 01:44, 2 January 2025
1
Template that augments the counter parser function so that its output can be part of a sorted table. This template creates both a hidden counter (for correct sorting) and a visible counter for display.
Usage:
{{ vcount | countername }}
where countername is the name of the counter being used. This parameter is required. Place this template in each cell of a given column. You can specify custom increment values for the counter (note that brackets denote optional parameters):
{{ vcount | countername [ | increment ] }}
IMPORTANT:
Please be sure to first reset the counter using the {{hresetcount}} template before making any calls to this template in order for this process to work correctly. Under the hood, this template also uses {{hcount}}. But here, two separate counters are initialized: a visible and a hidden counter. These values are incremented in lockstep, but the hidden counter is offset by 10,000 relative to the visible counter. Similarly, up to 6 pairs of counters may be initialized. See that template for more information.
Optionally, you may set the initial visible counter value to something other than the default value of 1:
{{hresetcount | countername | vv=25 }}
This resets the visible counter to 25 but the hidden counter is still initialized to 10,000. You can set the hidden counter value to something other than the default value of 10,000 and count by something other than the default value of 1 in the same call.
{{hresetcount | countername | v=9999 | vv=100 | countby=-1 }}
This resets the hidden counter to a value of 9,999 and the visible counter to a value of 100 (once the proper increment of -1 is applied when calling the template). Subsequent calls to this template will continue to decrease both counters by 1.
Technical Information:
- vcount creates two separate counters, one for the hidden count, another for the visible count. Specifically, the template appends "_visible" to the counter name specified in the first parameter to create the visible counter (e.g. counter1 and counter1_visible).