Tree Action
See Also
- WikkaBugsResolved - Original ExistsPage function by JavaWoman
- WikkaOptimization - Faster cached version by IanAndolina
What
- Finds pages within the current page name and builds a menu with it.
- If you add sub-pages by adding a string to the parent page name (e.g. OnegWRTree is the sub-page Tree of the parent-page OnegWR) you can loop trough the string and check if this string within the page name is a page on it's own...
Use
- Include on the page where you would like to include this little menu the string:
{{tree}}
Installation
- Save the code below as action/tree.php
- Give it the same file permissions as the other php files in that directory.
- Note: function ExistsPage is included in 1.1.6.0
Code
<?php
// Display a 'tree' of parent-pages by OnegWR
// e.g. OnegWR > OnegWRactions > OnegWRactionsTree
$treelink=$this->Link($this->config["root_page"]);
$treepage="";
$max = strlen($this->tag);
for($i=0;$i<$max;$i++){
$treepage .= $this->tag{$i};
if( $this->ExistsPage($treepage) ){
$treelink .= " > ";
$treelink .= $this->Link($treepage);
}
}
print $treelink;
?>
// Display a 'tree' of parent-pages by OnegWR
// e.g. OnegWR > OnegWRactions > OnegWRactionsTree
$treelink=$this->Link($this->config["root_page"]);
$treepage="";
$max = strlen($this->tag);
for($i=0;$i<$max;$i++){
$treepage .= $this->tag{$i};
if( $this->ExistsPage($treepage) ){
$treelink .= " > ";
$treelink .= $this->Link($treepage);
}
}
print $treelink;
?>
History
- Published on main site (2005-05-09) - OnegWR
To Do
- Add switch: start at root_page or not?
- Add switch: Reverse, print menu right to left
- Add css tags
CategoryUserContributions