page_whiteBuilds a tree of child pages
TypePlugin
Developed by

xwiki:XWiki.FriedemannLoew

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

A new Document Tree Macro, and a generic Tree Macro have been introduced in XWiki 6.3.

The document tree plugin builds a tree of child pages. It can be used to show the child pages of a defined page or to show all pages of a space.

Installation

Copy the jar-Archive to the %xwikipath%/WEB-INF/lib/ directory of your xwiki installation and add com.xpn.xwiki.plugin.doctree.DocumentTreePlugin to the xwiki.cfg.

The DocumentTreePlugin has two main methods to call:

$xwiki.doctree.getDocumentTree(rootDocument, sorted)

$xwiki.doctree.getSpaceDocumentTree(spaceName, sorted)

The default for sorted is true. In this way you get a tree with alphabetically sorted nodes. If you want the tree to contain the nodes in order of creation, you have to set sorted to false.

Example

To get a Tree with the children of a page, alphabetically sorted nodes:

$xwiki.doctree.getDocumentTree($doc)

To get a Tree with all the Documents of a space, nodes in order of creation:

$xwiki.doctree.getSpaceDocumentTree($doc.web, false)

Also see Children Page Tree

The jar Archive also contains examples for use.

Prerequisites & Installation Instructions

Follow these steps:

  • Add the JAR in your container classpath (WEB-INF/lib)
  • Edit xwiki.cfg and add the following line to the list of plugins :
    xwiki.plugins=\
          [...]
           ... ,\
          <plugin package>
  • Restart your container
  • Verify the plugin is properly installed by typing the following in a wiki page :
    {{velocity}}
    $xwiki.<plugin name>.name
    {{/velocity}}

    If the installation has been successful, you will see <plugin name>.

Created by FriedemannLoew on 2007/02/27 17:02
    

Get Connected