Difference between revisions of "Template:ShowCategories"

From OIAr Archive 2013
Jump to navigation Jump to search
(result type)
(arraymap for prefix-removal)
Line 2: Line 2:
 
[[Category:Templates]]
 
[[Category:Templates]]
 
This simple template takes a single parameter ''page='' and returns a list of all the categories that the page belongs to.<br>
 
This simple template takes a single parameter ''page='' and returns a list of all the categories that the page belongs to.<br>
The list is alphabetically sorted, and a comma is used as the delimiter.
+
Each category shown is just the category name without the prefix "category:". The list is unsorted, and a comma is used as the delimiter.
  
 
Usage:
 
Usage:
 
<pre><nowiki>{{ShowCategories|page= }}</nowiki></pre>
 
<pre><nowiki>{{ShowCategories|page= }}</nowiki></pre>
</noinclude><includeonly>{{#show:{{{page}}}|?Category|link=none|format=list|template=StripPrefix|userparam=9|sep=,}}
+
</noinclude><includeonly>{{#arraymap:{{#show:{{{page}}}|?Category|link=none|format=list|sep=,}}|,|{{#sub:{{{1}}}|9}}}}

Revision as of 11:05, 29 December 2012

This simple template takes a single parameter page= and returns a list of all the categories that the page belongs to.
Each category shown is just the category name without the prefix "category:". The list is unsorted, and a comma is used as the delimiter.

Usage:

{{ShowCategories|page= }}