How to use the category tree extension

From Software Business Community

Jump to: navigation, search

Usage of the CategoryTree Extension

CategoryTree can be used in three ways: directly on the category pages, as a "custom tag" to show a category structure inline on a wiki page, and as a special page.

The CategoryTree extension replaces the subcategory section of category pages with a dynamic tree view. If Javascript is disabled, this appears as a plain list. The dynamic subcategory entries can be disabled using the URL parameter "notree" - this is intended for bots that rely on parsing the HTML of category pages.

The custom tag is called < categorytree >. For example, if you put < categorytree mode="pages" >Foo< /categorytree > on a wiki page, it will show the contents of category Foo as a dynamic tree on that page. The tag accepts the following attributes, using a HTML-like syntax:

* hideroot - set this to "on" to hide the "root" node of the tree, i.e.
            the mention of category Foo from the example.
            
* onlyroot - set this to "on" show only the "root" node of the tree initially
            
* mode - can be "categories", "pages" or "all". See the Modes section below.
        The default for this attribute is controlled by 
        $wgCategoryTreeDefaultMode, and is initially set to CT_MODE_CATEGORIES,
        the equivalent of setting the mode attribute to "categories".
        
* style - can be used to specify any CSS styles you would like for the
         tree.

Alternatively to the < categorytree > tag, parser-function syntax can also be used, e.g { { #categorytree:Foo|hideroot=yes } }. This syntax allows the use of magic variables, templates and template parameters for the category name.

The special page is called Special:CategoryTree; there you can enter the name of a category and then browse it's content. The CategoryTree extension also adds a tab for this special page to every category page.


MODES

The category tree can be shown in different modes, determining what types of "leaves" the "tree" has:

  • categories (constant CT_MODE_CATEGORIES): show subcategories only
  • pages (constant CT_MODE_PAGES): show subcategories and pages, except images
  • all (constant CT_MODE_ALL): show all pages, subcategories, images, etc

External links

CategoryTree extension man page