Template:vcount

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(adding sort info link)
(use new cat)
(includes 3 intermediate revisions)
Line 1: Line 1:
-
{{hcount|{{{1}}}}}{{#count:{{{1}}}_visible|{{{2|1}}}|{{{3|}}}}}<noinclude>
+
{{hcount|{{{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]].
+
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> vcount | ''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.  The usage of this template is similar to that of {{tl|hcount}} although the extended functionality of '''#count''' is also available where you can specify custom increment values for the visible counter (''and note that brackets denote optional parameters''):
-
:<code><nowiki>{{ </nowiki> vcount | ''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|hresetcount}} 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:hresetcount|hresetcount]] | ''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|hresetcount}} 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. (''However, this is not recommended and in most cases, unnecessary.'') :
 +
:<code><nowiki>{{</nowiki>[[Template:hresetcount|hresetcount]] | ''countername''  | v=100000 | vv=10 }}</code>
 +
This resets the hidden counter to a value of 100,000 and the first visible value to 10.
'''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>

Revision as of 22:09, 25 November 2017

11


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. The usage of this template is similar to that of {{hcount}} although the extended functionality of #count is also available where you can specify custom increment values for the visible counter (and 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. (However, this is not recommended and in most cases, unnecessary.) :

{{hresetcount | countername | v=100000 | vv=10 }}

This resets the hidden counter to a value of 100,000 and the first visible value to 10.

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

See Also

Personal tools