Difference between revisions of "Template:Categorizer"

From Twinsuniverse
Jump to: navigation, search
m
(eliminated the display parameter of the categorizer)
Line 5: Line 5:
 
         | {{#vardefine: infobox_messages | {{#var: infobox_messages|}}[[Category:{{{category}}}]]}}
 
         | {{#vardefine: infobox_messages | {{#var: infobox_messages|}}[[Category:{{{category}}}]]}}
 
         | [[Category:{{{category}}}]] }} }}}}{{
 
         | [[Category:{{{category}}}]] }} }}}}{{
#switch: {{lc:{{{display|true}}}}}
+
#ifeq: {{lc:{{{display|true}}}}} | true
| true
+
| {{categorylink
| infobox = {{categorylink
+
 
     |category={{{category|}}}
 
     |category={{{category|}}}
 
     |catlabel={{{catlabel|}}}
 
     |catlabel={{{catlabel|}}}
Line 13: Line 12:
 
     |label={{{label|{{{article|}}}}}}}}
 
     |label={{{label|{{{article|}}}}}}}}
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
This template is used to add a header to an infobox, tagging it's articles and automatically categorizing them under a category.
+
This template is used to add a heading to an infobox, tagging it's articles and automatically categorizing them under a category. The display of this heading may be turned off to merely categorize an article, and in such cases this template makes sure there is no output where it is called, so that infobox rows may gracefully collapse rather than remaining empty.
  
All display of this template is done by the <nowiki>{{</nowiki>[[Template:Categorylink|Categorylink]]<nowiki>}}</nowiki>, and may be turned off altogether to categorize articles only.
+
All actual display of this template is managed by the <nowiki>{{</nowiki>[[Template:Categorylink|Categorylink]]<nowiki>}}</nowiki>.
  
 
==Parameters==
 
==Parameters==
Line 22: Line 21:
 
* '''display''': Whether or not to display the categorylink (case insensitive, defaults to "true")
 
* '''display''': Whether or not to display the categorylink (case insensitive, defaults to "true")
 
* '''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).
 +
 +
 +
'''''Note''': The '''display''' parameter should only be specified if it's actually used, as it also activates on the empty value.''
  
 
==Syntax==
 
==Syntax==
 +
Common use includes these four parameters:
 
  <nowiki>{{categorizer
 
  <nowiki>{{categorizer
 
  |category=
 
  |category=
Line 29: Line 32:
 
  |article=
 
  |article=
 
  |label=
 
  |label=
|display=
 
|nocat=
 
 
}}</nowiki>
 
}}</nowiki>
  
Line 36: Line 37:
 
For explanation of the above first four parameters, see the [[Template:Categorylink|Categorylink]] template.
 
For explanation of the above first four parameters, see the [[Template:Categorylink|Categorylink]] template.
  
You may remove the display of the categorylink by specifying the "false" value for the '''display''' parameter, so these all have the same result (nothing displayed):
+
You may remove the display of the categorylink by specifying any other value than "true" for the '''display''' parameter, so these all have the same result (nothing displayed, but still categorized):
  <nowiki>{{categorizer
+
  <nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=}}</nowiki>
|category=Quetch characters
+
  <nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=     }}</nowiki>
|catlabel=This text is simply ignored
+
|article=As is the article
+
|label=Forget the label
+
  |display=false
+
}}</nowiki>
+
 
  <nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=false}}</nowiki>
 
  <nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=false}}</nowiki>
  <nowiki>{{categorizer|category=Quetch characters|display=false}}</nowiki>
+
  <nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=nope}}</nowiki>
 
+
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=yes}}</nowiki>
{{sectstub}}
+
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=all}}</nowiki>
  
 
Note that adding the value "true" to the '''nocat''' parameter to any of the above examples results in exactly the same as not calling this template.
 
Note that adding the value "true" to the '''nocat''' parameter to any of the above examples results in exactly the same as not calling this template.

Revision as of 18:39, 3 January 2013

This template is used to add a heading to an infobox, tagging it's articles and automatically categorizing them under a category. The display of this heading may be turned off to merely categorize an article, and in such cases this template makes sure there is no output where it is called, so that infobox rows may gracefully collapse rather than remaining empty.

All actual display of this template is managed by the {{Categorylink}}.

Parameters

  • category: The category name to use for the Template:Categorylink and categorization (case sensitive, mandatory)
  • catlabel, article and label: Additional parameters for the Template:Categorylink.
  • display: Whether or not to display the categorylink (case insensitive, defaults to "true")
  • nocat: Whether or not to suppress categorization under category (defaults to false, which means auto categorization).


Note: The display parameter should only be specified if it's actually used, as it also activates on the empty value.

Syntax

Common use includes these four parameters:

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

Examples

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

You may remove the display of the categorylink by specifying any other value than "true" for the display parameter, so these all have the same result (nothing displayed, but still categorized):

{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=     }}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=false}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=nope}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=yes}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=all}}

Note that adding the value "true" to the nocat parameter to any of the above examples results in exactly the same as not calling this 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]

This would prevent the page from being categorized under Category:Quetches, which is useful if you only want to render the categorylink without categorization, and if using the Categorylink directly is not desired/possible (i.e. when calling this template indirectly).