Tree-menu Block for PHP-Nuke
Date: Wednesday, January 08, 2003 @ 9:32 AM CST
Topic: Nuke Blocks


Hello nukers,

have you felt the need for a flexible menu block, perhaps as a replacement of the Modules block? Then the newly released Treemenu Block may be right for you.
Click on the read more link for more details.

A commonly asked question in PHPNuke forums is if there exists some Module block out there that displays a dynamic view of the available modules. The webmaster needs a functionality that will allow for the display of only certain module links, depending on, say, the interests, access level, or preferences of the viewer. What is needed is a module block that displays some links (to modules, or generally, to pages) when a certain condition is met (say, when Category A was previously chosen) and some other ones when a different condition is true (e.g. when Category B was chosen).
To met these requirements, I have adapted the well-known Treemenu concept to a PHP-Nuke Block. I have created a PHP-Nuke block containing a Treemenu. It will look like this:

http://www.karakas-online.de/myTreemenu/images/treemenu.png
When the user clicks on an item like "Links", the sub-tree under this item is unfolded:
http://www.karakas-online.de/myTreemenu/images/treemenu1.png
and so on.

Tree-menu is a PHP class created by Bjorge Dijkstra and adapted by Denny Shimkoski. I have fixed some bugs in the version of the latter and incorporated it in a PHPNuke Block.
There are two ways you can use the Tree-menu class - I use the one that takes as input a simple text file and creates a tree menu, in a style that most users are familiar with from a graphical file manager.
And of course, you may tweak it very easily to display multiple Tree-menus, or dynamic ones using a criterion of your choice. Thus, you can display one Tree-menu when the user chose, say, Category A, and a different one for Category B. See

http://www.karakas-online.de/myTreemenu/refinements.html#AEN450
You control the tree structure of your menu from a simple text file, see
http://www.karakas-online.de/myTreemenu/what-is-treemenu.html#INPUT-FILE-METHOD

Of course, this is only a quick and easy solution. If your menu has to change very often, you will need some kind of database support here. But for a lot of purposes this solution is perfectly acceptable.

You can get Treemenu Block at
http://www.karakas-online.de/phpnuke/block-Treemenu.tgz
Just extract it in the blocks directory and activate it. It comes with a sample sitemap text file. But you should also read the detailed documentation at
http://www.karakas-online.de/myTreemenu/t1.html
which may be read online, or downloaded in various formats (HTML, PDF, PS, RTF, TXT...) from
http://www.karakas-online.de/myTreemenu/introduction.html#FORMATS
Let me just add a big Thank You to Bjorge Dijkstra and Denny Shimkoski for creating and improving the Treemenu PHP class, which is used in this PHPNuke block.

Regards
Chris





This article comes from Nuke Resources
http://www.nukeresources.com

The URL for this story is:
http://www.nukeresources.com/modules.php?name=News&file=article&sid=242