Difference between revisions of "Template:Categorizer"

From Twinsuniverse
Jump to: navigation, search
m
Line 1: Line 1:
 
<includeonly>{{
 
<includeonly>{{
#ifeq: {{{article|}}} |
+
#ifeq: {{lc: {{{nocat|false}}} }} | false | [[Category:{{{category}}}]]
|{{
+
}}{{categorylink
    #if: {{{label|}}}
+
     |category={{{category|}}}
    | {{{label}}}
+
    |catlabel={{{catlabel|}}}
    | ''missing article'' {{#ifeq: {{lc:{{SUBJECTSPACE}}}} | template | [[Category:Categorizers missing an article]] }} }}
+
     |article={{{article|}}}
|{{
+
    |label={{{label|}}}
    #if: {{{label|}}}
+
    | [[{{{article}}}|{{{label}}}]]
+
     | [[{{{article}}}]] }} }}{{
+
#if: {{{category|}}}
+
| {{superlink|article=:Category:{{{category}}}|label={{{catlabel|list all}}} }}{{
+
     #ifeq: {{lc: {{{nocat|false}}} }} | false | [[Category:{{{category}}}]] }}
+
| {{superlink|label=missing category}} {{#ifeq: {{lc:{{SUBJECTSPACE}}}} | template | [[Category:Categorizers missing a category]] }}
+
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
This template is used to add a tag to an infobox, labeling and automatically categorize the article under a category. A [[Template:Superlink|superlink]] is used to render a link to the target category.
+
This template is used to add a header to an infobox, labeling with and automatically categorizing the article under a category. A <nowiki>{{</nowiki>[[Template:Categorylink|Categorylink]]<nowiki>}}</nowiki> is used for display.
 
+
:<nowiki>{{categorizer</nowiki> | category = ''category name'' | catlabel = ''displayed text on categorylink'' | article = ''an article about the category'' | label = ''displayed text on articlelink'' }}
+
  
 
==Parameters==
 
==Parameters==
* '''category''': The target category to add this article to.
+
* '''category''', '''catlabel''', '''article''', '''label''': The parameters for the [[Template:Categorylink]].
* '''catlabel''': The text to display on the categorylink (defaults to "list all").
+
* '''article''': The article that represents the target category (defaults to the label not to become linked).
+
* '''label''': The text to display on the link to the article (defaults to the article pagename).
+
 
* '''nocat''': Whether or not to suppress categorization under '''''category''''' (defaults to false, which means auto categorization).
 
* '''nocat''': Whether or not to suppress categorization under '''''category''''' (defaults to false, which means auto categorization).
  
Line 35: Line 23:
  
 
==Examples==
 
==Examples==
Common use of the categorizer includes both '''category''' and '''article''' parameters:
+
For explanation of the above first four parameters, see the [[Template:Categorylink|Categorylink]] template.
<nowiki>{{categorizer|category = Quetches|article = Quetch}}</nowiki>
+
  
:[[Quetch]]{{superlink|article=:Category:Quetches|label=list all}}
+
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
(and the page would be categorized under [[:Category:Quetches]])
+
 
+
 
+
Both the displayed texts on the category and article links can be customized using the '''catlabel''' and '''label''' parameters respectively:
+
 
  <nowiki>{{categorizer
 
  <nowiki>{{categorizer
  |category = Quetches
+
  |category=Quetches
|catlabel = list members
+
  |article=Quetch
  |article = Quetch
+
  |nocat=true
  |label = Men
+
 
}}</nowiki>
 
}}</nowiki>
 
:[[Quetch|Men]]{{superlink|article=:Category:Quetches|label=list members}}
 
(and the page would be categorized under [[:Category:Quetches]])
 
 
 
If the '''article''' parameter is left out, the categorizer won't render a link on the '''label''':
 
<nowiki>{{categorizer|category = Quetches|label = Men}}</nowiki>
 
 
:Men{{superlink|article=:Category:Quetches|label=list all}}
 
(and the page would be categorized under [[:Category:Quetches]])
 
 
 
If both the '''article''' and '''label''' parameters are left out, the categorizer will render error text like this:
 
<nowiki>{{categorizer|category = Quetches}}</nowiki>
 
 
:''missing article''{{superlink|article=:Category:Quetches|label=list all}}
 
(and the page would be categorized under [[:Category:Quetches]], and templates would be categorized under [[:Category:Categorizers missing an article]])
 
 
 
If the '''category''' parameter is left out, regardless of parameter '''catlabel''', the categorizer will render like this:
 
<nowiki>{{categorizer
 
|catlabel = list members
 
|article = Quetch
 
|label = Men
 
}}</nowiki>
 
 
:[[Quetch|Men]]{{superlink|label=missing category}}
 
(and the page would '''not''' be categorized automatically, and templates would be categorized under [[:Category:Categorizers missing a category]])
 
 
 
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
 
<nowiki>{{categorizer|category = Quetches|article = Quetch|nocat = true}}</nowiki>
 
  
 
:[[Quetch]]{{superlink|article=:Category:Quetches|label=list all}}
 
:[[Quetch]]{{superlink|article=:Category:Quetches|label=list all}}

Revision as of 23:55, 5 December 2012

This template is used to add a header to an infobox, labeling with and automatically categorizing the article under a category. A {{Categorylink}} is used for display.

Parameters

  • category, catlabel, article, label: The parameters for the Template:Categorylink.
  • nocat: Whether or not to suppress categorization under category (defaults to false, which means auto categorization).

Syntax

{{categorizer
 |category =
 |catlabel =
 |article =
 |label =
 |nocat =
}}

Examples

For explanation of the above first four parameters, see the Categorylink template.

The nocat parameter may be used to suppress automatic categorization like this (any value will do):

{{categorizer
 |category=Quetches
 |article=Quetch
 |nocat=true
}}
Quetch [list all]

(and the page would not be categorized under Category:Quetches)