Trail2Menu
<< Wiki Farm | Cookbook-V1 | Drop Down Menu >>
Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
Goal
A wiki-editable, expanding navigation menu.
This module converts a Wiki Trail page into an expanding side-menu allowing one to organize wiki pages into a free-form hierarchal structure (at least for navigation purposes). Includes an associated bread crumb trail function.
Solution
Download the files: Attach:t2m-0.1.tgz
The archive will unpack into a directory named t2m-0.1/. Copy this directory and its contents into your local/ subdirectory.
Add the following line to your config.php file:
include_once('local/t2m-0.1/t2m-config.php');
Look at the t2m-config.php file for some variables that you can configure for your specific installation. I'll assume the default settings are in place for the following instructions.
Because of the way I'm producing the output, you have to make separate wiki pages for the side menu and breadcrumb trail. On the trail2menu test site I just modified the default pmwiki template (minimal).
The first thing is to setup a wiki page that will hold the side menu (Main.SideBar in this example). Here's the source of the trail2menu test site side menu.
You will also need a page to hold the wiki trail that describes the site structure. I have mine stored in Main.SiteTrail. Check out the source of the trail2menu site trail. Note that this is the page you edit when you click on the edit link in the side menu.
If you want a breadcrumb output, you will need to make a separate breadcrumb page (Main.BreadCrumb in my example). See the source. Exciting stuff, isn't it? I included the above wiki page (Main.BreadCrumb) in my HTML template to make sure it was available on every page.
Finally, if you want to have a diagnostic output page (helps if you have a lot of wiki pages you're trying to put/keep in the menu), you will need a page to dump the trail information. I named mine Main.DumpTrail.
On the diagnostic page, you can control whether or not it lists unlinked files in the wiki.d/ directory via the $TrailMenuDumpAllPages variable.
Its likely that I have gaps in my instructions. Comments and/or suggestions welcome.
Discussion
Check out the trail2menu test site to see if you might find it helpful. Feel free to modify the menu and add pages to the site to see what it can do.
An alternative way may be Cookbook/OrGrSkin. I use this on http://www.wikiwiki.de. MaWo
See Also
Um, maybe something on Wiki Trail markup?
Also link to instructions on including a wiki page from the HTML template (breadcrumb).
History
May 22, 2004 | First release |
Comments & Bugs
Comments by Wooshoofoo:
- There's a bug in the t2m-config.php, on line 23. It should read:
include_once("local/t2m-0.1/trail2menu.php");
Comments by Henning:
- Looks very neat for extensive menu structures.
- Seems to have problems with multiple occurrences of pages (I'm slightly confused about that)
- There seems to be a problem with the first trail entry - child entries don't fold out. Moving the trail entry to a different position makes that entry work, transferring the problem to the new first entry.
- Apparently, only wiki pages can be addressed while normal URLs are suppressed due to the trail nature of the menu page. I consider that a bit of a limitation.
- Arrows don't display in my wiki. HTML shows full URLs being provided for links, but "/pub/.../arrow.gif" for arrow images.
- Arrows can be fixed by providing full paths in t2m-config.php
Contributors
- Patrick Michaud gave me the idea of using a wiki trail as the foundation of the menu. I also used his trail traversal approach.
Copyright
Copyright 2004 Niall Durham. Released under GPL. pmwiki-2.3.38 -- Last modified by {{}}?