Get our free book on rainwater now - To Catch the Rain.


From Appropedia
Jump to: navigation, search
This explains how to make and use a category tree. There is also a full category tree of the whole Appropedia wiki site.

Basic usage[edit]

<categorytree>Energy</categorytree> produces:

Using in templates[edit]

There is another version which uses parser functions, and can be used in templates:



CategoryTree can be used in three ways:

  1. directly on the category pages (through the wiki site's settings)
  2. as a "custom tag" to show a category structure in-line on a wiki page
  3. and as a special page.

The CategoryTree extension adds [+] "expand" widgets to the subcategories listed on category pages. If Javascript is disabled, those widgets just do nothing.

The <categorytree> tag[edit]

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 examples). The tag accepts the following attributes, using a HTML-like syntax:

can be "categories", "pages" or "all". The default for this attribute is set to "categories". (E.g. <categorytree mode=pages>Gardening</categorytree> will show all the subcategories and pages in the Gardening category.
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. note: depth values greater than 1 do not (yet) work with $wgCategoryTreeDynamicTag enabled!
set this to "on" to only show the "root" node of the tree initially. Equivalent to depth="0". Deprecated USE depth="0"
set this to "on" to hide the "root" node of the tree, i.e. the mention of category Foo from the example.
can be used to specify any CSS styles you would like for the tree.


Basic example[edit]

<categorytree>Water</categorytree> produces:

Example with mode and style options[edit]

<categorytree mode=pages style="float:right; clear:right; margin-left:1ex; border:1px solid gray; padding:0.7ex; background-color:white;">Soil</categorytree> produces:

Interwiki links[edit]