Difference between revisions of "Template:Category"

From Hitchwiki
Jump to navigation Jump to search
 
Line 1: Line 1:
{{#if: {{#if: {{{5|}}} | {{#ifexist: Category:{{{5}}} | true }} }} | [[Category:{{{5}}}]] |<!--
+
<noinclude>[[Image:Directed graph with back edge.svg|thumb|Where 2 is a subcategory of 1. In general, this kind of categorization doesn't make sense.]]This template helps with page categorizing. It's intented for use especially in other templates. Takes max. 5 parameters and starts to check category existence from the last one, only the last existing category is used as a result.
 +
 
 +
== Examples ==
 +
<pre>
 +
{{Category|Europe|Germany|Bavaria|nonexistentcategory}}
 +
--> [[Category:Bavaria]]
 +
 
 +
{{Category|Germany|Bavaria}}
 +
--> [[Category:Bavaria]]
 +
 
 +
{{Category|Canada|Quebec|Montérégie}}
 +
--> [[Category:Quebec]]
 +
</pre>
 +
 
 +
== Note ==
 +
Tthis template doesn't check if a category is under another category, picture is only informal. Therefore it's good to use for geo/administrative categories. Don't use it to put page in more categories e.g. ''<nowiki>{{Category|Poland|Slovakia|Border crossings}}</nowiki>''.
 +
</noinclude><includeonly><!--
 +
-->{{#if: {{#if: {{{5|}}} | {{#ifexist: Category:{{{5}}} | true }} }} | [[Category:{{{5}}}]] |<!--
 
-->{{#if: {{#if: {{{4|}}} | {{#ifexist: Category:{{{4}}} | true }} }} | [[Category:{{{4}}}]] |<!--
 
-->{{#if: {{#if: {{{4|}}} | {{#ifexist: Category:{{{4}}} | true }} }} | [[Category:{{{4}}}]] |<!--
 
-->{{#if: {{#if: {{{3|}}} | {{#ifexist: Category:{{{3}}} | true }} }} | [[Category:{{{3}}}]] |<!--
 
-->{{#if: {{#if: {{{3|}}} | {{#ifexist: Category:{{{3}}} | true }} }} | [[Category:{{{3}}}]] |<!--
 
-->{{#if: {{#if: {{{2|}}} | {{#ifexist: Category:{{{2}}} | true }} }} | [[Category:{{{2}}}]] |<!--
 
-->{{#if: {{#if: {{{2|}}} | {{#ifexist: Category:{{{2}}} | true }} }} | [[Category:{{{2}}}]] |<!--
-->{{#if: {{{1|}}} | {{#ifexist: Category:{{{1}}} | [[Category:{{{1}}}]] }} }} }} }} }} }}
+
-->{{#if: {{{1|}}} | {{#ifexist: Category:{{{1}}} | [[Category:{{{1}}}]] }} }} }} }} }} }}<!--
 +
--></includeonly>

Latest revision as of 11:00, 22 October 2014

Where 2 is a subcategory of 1. In general, this kind of categorization doesn't make sense.

This template helps with page categorizing. It's intented for use especially in other templates. Takes max. 5 parameters and starts to check category existence from the last one, only the last existing category is used as a result.

Examples

{{Category|Europe|Germany|Bavaria|nonexistentcategory}}
--> [[Category:Bavaria]]

{{Category|Germany|Bavaria}}
--> [[Category:Bavaria]]

{{Category|Canada|Quebec|Montérégie}}
--> [[Category:Quebec]]

Note

Tthis template doesn't check if a category is under another category, picture is only informal. Therefore it's good to use for geo/administrative categories. Don't use it to put page in more categories e.g. {{Category|Poland|Slovakia|Border crossings}}.