Template:vcount

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
m (See Also: demote)
(document countby)
 
(includes 9 intermediate revisions)
Line 1: Line 1:
-
{{hcount|{{{1}}}}}{{#count:{{{1}}}_visible|{{{2|1}}}|{{{3|}}}}}<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 sorted table.
+
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.
'''Usage:'''
'''Usage:'''
-
:<code><nowiki>{{ </nowiki> hcount | ''countername'' }}</code>
+
:<code><nowiki>{{ </nowiki> vcount | ''countername'' }}</code>
-
where ''countername'' is the name of the counter being used.  Place this template in each cell of a given column. The usage of this tempalte is similar to that of {{tl|hcount}} although the extended functionality of '''#count''' is also available (''and note that brackets denote optional parameters''):
+
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> hcount | ''countername'' [ | ''initial value'' ] [ | ''increment'' ] }}</code>
+
:<code><nowiki>{{ </nowiki> vcount | ''countername'' [ | ''increment'' ] }}</code>
'''IMPORTANT:'''  
'''IMPORTANT:'''  
-
Please be sure to first reset the counter before making any calls to this template in order to a sufficiently high enough by using the {{tl|hreset}} template:
+
Please be sure to first reset the counter before making any calls to this template in order to a sufficiently high enough by using the {{tl|hresetcount}} template:
-
:<code><nowiki>{{</nowiki>[[Template:hreset|hreset]] | ''countername''}}</code>
+
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername'' }}</code>
-
This ensures that the table is sorted correctly (in proper numerical order). For more information on using {{tl|hreset}} please read the documentation for {{tl|hcount}}.
+
This ensures that the table is sorted correctly (in proper numerical order). You may also reset up to '''6''' counters with the {{tl|hresetcount}} template. (''Note that brackets denote optional parameters''):
 +
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername1'' [ |''countername2'' ] [ | ''countername3'' ] [ |''countername4'' ] [ |''countername5'' ] [ |''countername6'' ] }}</code>
 +
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>
 +
This resets the visible counter to 25. In addition, 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. (''It is recommended to use a value with all nines if counting by a negative value.'') :
 +
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername''  | v=9999 | vv=100 | countby=-1 }}</code>
 +
This resets the hidden counter to a value of 9,999 and the first visible value to 100 (once the proper increment of -1 is applied when calling the counter).
'''Technical Information:'''
'''Technical Information:'''
-
* '''vcount''' creates two separate counters, one for the hidden count, another for the visible count (i.e. ''counter1'' and ''counter1_visible'')In other words, the template appends "_visible" to the counter name specified in the first parameter.
+
* '''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'').
==== See Also ====
==== See Also ====
*[[HRWiki:Counter|Counter function usage]]
*[[HRWiki:Counter|Counter function usage]]
*{{tl|hcount}}
*{{tl|hcount}}
-
[[Category:Formatting Templates|{{PAGENAME}}]]
+
[[Category:Counter Formatting Templates|{{PAGENAME}}]]
</noinclude>
</noinclude>

Current revision as of 16:52, 4 February 2021

1 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 before making any calls to this template in order to a sufficiently high enough by using the {{hresetcount}} template:

{{hresetcount | countername }}

This ensures that the table is sorted correctly (in proper numerical order). You may also reset up to 6 counters with the {{hresetcount}} template. (Note that brackets denote optional parameters):

{{hresetcount | countername1 [ |countername2 ] [ | countername3 ] [ |countername4 ] [ |countername5 ] [ |countername6 ] }}

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. In addition, 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. (It is recommended to use a value with all nines if counting by a negative value.) :

{{hresetcount | countername | v=9999 | vv=100 | countby=-1 }}

This resets the hidden counter to a value of 9,999 and the first visible value to 100 (once the proper increment of -1 is applied when calling the counter).

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).

[edit] See Also

Personal tools