Difference between revisions of "Template:Invocations"

From QBWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 
<includeonly>{{Add|{{FULLPAGENAME}}_invocations|1}}{{#vardefine:invocations|{{#var:{{FULLPAGENAME}}_invocations}}}}{{#var:invocations}}</includeonly><noinclude>
 
<includeonly>{{Add|{{FULLPAGENAME}}_invocations|1}}{{#vardefine:invocations|{{#var:{{FULLPAGENAME}}_invocations}}}}{{#var:invocations}}</includeonly><noinclude>
 
{{Template doc|
 
{{Template doc|
 +
{{Warning|This template has been abandoned because it '''does not work as intended'''. The desired behavior can still be achieved by manually defining a variable and iterating it, but this template's intended usage as a shorthand for defining this variable fails because "<nowiki>{{FULLPAGENAME}}</nowiki>" always takes the name of the outermost page, not any intermediate templates. This means that usages of this template will share a counter between all calls ''on the outermost page'', not all calls on the currently edited template.}}
 
A simple counter that can be used to track the number of times a particular template has been invoked ''if'' included exactly once. Emits a value that will be consistent for a given invocation, meaning it can be used to define invocation-specific variables.
 
A simple counter that can be used to track the number of times a particular template has been invoked ''if'' included exactly once. Emits a value that will be consistent for a given invocation, meaning it can be used to define invocation-specific variables.
 
This '''does not work as intended''' because of how "<nowiki>{{FULLPAGENAME}}</nowiki>" always takes the name of the outermost page, not any intermediate templates. To achieve the desired behavior, manually define a variable and iterate it.
 
  
 
<pre>
 
<pre>

Latest revision as of 18:06, 20 December 2025

Template documentation

Warning:
This template has been abandoned because it does not work as intended. The desired behavior can still be achieved by manually defining a variable and iterating it, but this template's intended usage as a shorthand for defining this variable fails because "{{FULLPAGENAME}}" always takes the name of the outermost page, not any intermediate templates. This means that usages of this template will share a counter between all calls on the outermost page, not all calls on the currently edited template.

A simple counter that can be used to track the number of times a particular template has been invoked if included exactly once. Emits a value that will be consistent for a given invocation, meaning it can be used to define invocation-specific variables.

{{Invocations}} -> {{Invocations}} -> {{Invocations}} ({{#var:Template:Invocations_invocations}}, {{#var:invocations}})

{{Invocations/test}} -> {{Invocations/test}}

1 -> 2 (, 2)