Home
Random
Recent changes
Special pages
Community portal
Preferences
About Sundering
Disclaimers
Sundering
Search
User menu
Talk
Contributions
Create account
Log in
Patches
|
Items
|
Quests
|
Creatures
|
Dungeons
|
NPCs
Attributes
|
Skills
|
Titles
|
XP Augmentation
|
Luminance Augmentation
|
Tailoring
Character Creation
β’
New Player Guide
β’
User Interface
β’
Glossary
Editing
Help:Using Category Trees
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Usage == CategoryTree can be used in three ways: * directly on the category pages, * as a "custom tag" (or "parser function") to show a category structure in-line on a wiki page, * and as a special page. The CategoryTree extension adds <nowiki>[+]</nowiki> "expand" widgets to the subcategories listed on category pages. If Javascript is disabled, those widgets takes you to the category page. === The <categorytree> tag === Example (click + box to expand the example of the Help Category to the right): <pre> <categorytree mode=pages>Help</categorytree> </pre> <categorytree mode=pages depth=0 style="float:right; clear:right; margin-left:1ex; border:1px solid gray; padding:0.7ex; background-color:white;">Help</categorytree> The custom tag is called <categorytree>. For example, if you put <categorytree>Foo</categorytree> on a wiki page, it will show the contents of category Foo as a dynamic tree on that page (see example to the right). <span id="options">The tag accepts the following attributes, using a HTML-like syntax</span>: ;mode: determines which pages are shown in the tree. This may be overridden by the use of the <tt>namespaces</tt> option. Possible values: :;categories: show subcategories only (configuration constant <tt>CT_MODE_CATEGORIES</tt>) :;pages: show subcategories and pages, except images (configuration constant <tt>CT_MODE_PAGES</tt>) :;all: show all pages, subcategories, images, etc (configuration constant <tt>CT_MODE_ALL</tt>) :;parents: list parent categories instead of subcategories (configuration constant <tt>CT_MODE_PARENTS</tt>). This puts CategoryTree into "inverse" operation. ;depth: determines how many levels of the tree are shown initially. Default is 1, 0 means only the root node. The maximum value depends on the mode specified, and on the $wgCategoryTreeMaxDepth option. ;<s>onlyroot</s>: Deprecated as of July 2008: use <tt>depth="0"</tt> instead. ;hideroot: set this to "on" to hide the "root" node of the tree, i.e. <tt>hideroot="on"</tt>. It will not display the category Foo in the example. ;hideprefix: determines when the namespace prefix should be hidden from entries in the tree. Possible values are: :;always: always hide the prefix. Should be used only if all pages come from the same namespace (configuration constant <tt>CT_MODE_CT_HIDEPREFIX_ALWAYS</tt>). :;never: never hide the namespace prefix, not even for categories (configuration constant <tt>CT_MODE_CT_HIDEPREFIX_NEVER</tt>). :;auto: hide the namespace of categories, if only categories are shown, as with <tt>mode="categories"</tt> (configuration constant <tt>CT_MODE_CT_HIDEPREFIX_AUTO</tt>); This is equivalent to the old default behavior. :;categories: always hide the namespace of categories, but show all other prefixes (configuration constant <tt>CT_MODE_CT_HIDEPREFIX_CATEGORIES</tt>). This is the new default behavior. ;showcount: show the number of entries in subcategories. This is disabled per default for category trees inlined on pages, but enabled per default in category listings an on Special:CategoryTree. ;namespaces: a list of namespaces from which pages should be shown in the tree. The entries in the list must be namespace names, separated by spaces. The main namespaces can be represented by "-" or "0". This overrides the <tt>mode</tt> option. ;class, style, id, ''etc'': The <categorytree> tag supports all standard HTML attributes for block elements. === The <nowiki>{{#categorytree}}</nowiki> parser function === You can also use ''parser function'' syntax to place a category tree on a page. This works just like the <categorytree> tag, using a different syntax, e.g. <tt><nowiki>{{#categorytree:Foo}}</nowiki></tt>; options can be specified using the syntax for named template parameters, e.g. <tt><nowiki>{{#categorytree:Foo|hideroot|mode=pages}}</nowiki></tt>. Using the parser function syntax has the advantage that it allows you to use magic words, templates and template parameters when specifying the category to show. Some examples: * Using a magic variable to show "this pages" category tree (may be useful on category description pages): <tt><nowiki>{{#categorytree:{{PAGENAME}}}}</nowiki></tt>. * Using a template to specify the category: <tt><nowiki>{{#categorytree:{{root category}}}}</nowiki></tt> - the name of the root category would be defined by the contents of Template:Root_category. * Using a template parameter to specify the category, when using CategoryTree inside a template: <tt><nowiki>{{#categorytree:{{{1}}}}}</nowiki></tt> in Template:Baz can be called using <nowiki>{{Baz|Foo}}</nowiki> === The Special:CategoryTree page === The special page is called [[:Special:CategoryTree]]; there you can enter the name of a category and then browse its content. [[Category:Help]]
Summary:
Please note that all contributions to Sundering may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Sundering:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
If you're new to the wiki, please take a moment to review our
Naming Conventions
and
Page Templates
. Using proper article names and image formats/sizes keep the wiki clean and helps avoid duplicate entries. Thanks!