Template:Category handler/numbered/doc: Difference between revisions
(Created page with "{{documentation subpage}} {{high-risk| 2,100,000+ }} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> This is the {{tl|category handler/numbered}} sub...") |
mNo edit summary |
||
Line 51: | Line 51: | ||
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | ||
[[Category:Wikipedia metatemplates]] | [[Category:Wikipedia metatemplates]] | ||
</includeonly> | </includeonly>[[Category:Templates]] |
Latest revision as of 18:51, 14 December 2012
This is a documentation subpage for Template:Category handler/numbered (see that page for the template itself). It contains usage information, categories and other content that is not part of the original template page. |
This template is used on 2,100,000+ pages. To avoid large-scale disruption and unnecessary server load, any changes should first be tested in this template's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this template. Please consider discussing any changes on the talk page before implementing them. |
This is the {{category handler/numbered}} sub-template.
Do not use this template directly, use {{category handler}} instead. This template is called from {{category handler}}, see user documentation there.
The rest of the sections here are only for those that want to understand the internal workings of this template.
Technical details[edit source]
This sub-template makes it possible for its parent-template to take input in two forms:
{{category handler | 1 = Input | main = 1 | talk = 1 <!--Reusing "Input" for both the main and talk parameters--> }} {{category handler | main = Input1 | talk = Input2 <!--Instead feeding text directly to the talk parameter--> }}
This sub-template takes a bunch of numbered parameters. There's no limit to the number of parameters it can use, other than what the servers and MediaWiki system can handle.
It also takes a parameter named data. If data is a number, then it returns the data of the corresponding numbered parameter. If data is something else, for instance a category name, then it returns data unchanged.
Here's how you would normally call this sub-template:
{{category handler/numbered | 1 = {{{1|}}} | 2 = {{{2|}}} | 3 = {{{3|}}} | 4 = {{{4|}}} | data = Input can be a number between 1-4, or something else. }}
In the above example, since the parent-template feeds only 1-4, then only the numbers 1-4 will work properly. Feeding other numbers will return an empty string.
See also[edit source]
- mw:Help:Extension:ParserFunctions – About
{{#iferror:||}}
etc.