Extension:TreeAndMenu

This extension is a single article or file which you can get from MediaWiki treeview.php which is to be included in your LocalSettings.php article or file. It allows tree-views to be created by surrounding a normal nested bullet list within a div tag as folows:
 * &lt;div class="tree-view">.


 * See Tree view for these same instructions but with a live example

Images
The images the tree-view uses are defined a the $treeviewImages global variable, opened and closed folder images and a document (leaf node) image are required, as well as plus and minus images to click on to open or close the folders. Also a spacer image is required which is just a single pixel transparent image used for layout.

You can create your own images, or use our ones which are listed in OrganicDesign:Category:Tree view images. Use the following format to define the images and place it before your include statement. $treeviewImages = array(	'plus'  => '/wiki/images/3/36/Arrow-closed.png',	'minus'  => '/wiki/images/d/df/Arrow-open.png',	'opened' => '/wiki/images/5/58/Folder_opn_sml_blu.gif',	'closed' => '/wiki/images/3/37/Folder_sml_blu.gif',	'doc'    => '/wiki/images/e/e3/Doc-icon.gif',	'spacer' => '/wiki/images/9/92/Spacer.png'	);

include('treeview.php');


 * 1) Alternatively you can comment out the include above and uncomment the following to include from an article instead
 * 2) $tmp = new Article(Title::newFromText('MediaWiki treeview.php'));
 * 3) eval('?>'.$tmp->fetchContent(0,false,false).'<?');

CSS styles
Other design aspects of the tree can be changed from your wiki's CSS stylesheet. The tree is in the form of an HTML table of CSS-class tree-view, and the rows are of class tree-row.

Sub-trees
Trees can be transcluded within other trees so we can define large trees from structures of smaller trees. Such sub-trees are defined using the following syntax: In this example, an article called Tree2 is transcluded as an item in Tree1. Tree2 is defined as a normal tree starting at root which can be used elsewhere in the normal way. The tree-view code matches nested trees and adjusts them to the appropriate depth for them to seemlessly integrate into single whole tree. The class and other attributes of sub-trees are ignored and the whole tree renders in accord with the attributes of the root tree.
 * Tree1
 * Item1
 * Sub item1
 * Item3
 * Item3

Testing

 * Works with both PHP4 and PHP5
 * Works on MediaWiki 1.6.7
 * Works on MediaWiki 1.9.3

Bugs

 * Sub-trees mess up if they're the last item in their level
 * Div's can't be used in the tree item content

Changes in version 2.0
This tree-view was originally created for our own Organic Design wiki which is a slightly different environment than a normal MediaWiki, so I had created a simple wrapper to allow the same code to work in normal MediaWiki's too. Using a wrapper like this meant that the trees wouldnt render properly if they were transcluded from another article, but that has now been fixed by creating a separate MediaWiki specific extension instead.

Changes in version 2.1
Added recursion capability.