Create a nested expanding menu (eg. in a sidebar) that keeps the current page visible, and have control over what parts of the menu-tree are visible (expanded).
It provides these features:
- Works with existing menu's
- Automatically expands entries referring to the current page
- Shows '+' and '-' to signify expandable and expanded items
- Works in combination with Cookbook.GeminiSkin? and Cookbook.FixFlowSkin?, that put every link in the sidebar on a separate line
- Provide markup to make other nodes visible/expanded.
Add the following line to local/config.php:
Surround a normal menu with
(:emenu2end:) directives. It is possible to have multiple such menu's visible at the same time, though you probably just want it for your SideBar.
Just like Cookbook.ExpandingMenu, it will add a
<div class="emenu"> around the menu, so you can modify it with CSS.
By default, all nodes that have a link to the current page (and their parent nodes) will be expanded. It is however possible to additionally make other nodes visible and expanded, by putting
in any page (not necessary the page containing the menu). See the example below.
The effect of this directive can be reverted with
(copy and paste to your page, it won't work here)
(:emenu2:) * [[Main/Home Page]] * [[Main/WikiSandbox]] * [[PmWiki/Documentation Index | Documentation]] ** [[PmWiki/Installation | Download and Install]] ** [[PmWiki/FAQ]] ** [[PmWiki/Release Notes]] ** [[PmWiki/ChangeLog]] * Submenu ** Submenu Item 1 ** Submenu Item 2 (:emenu2end:)
This would make the Documentation node expanded while you're visiting any of the pages beneath (Download and Install, FAQ, Release Notes or ChangeLog). You could, however, choose to make this node also expand when you're on the Home Page, by placing a
(:emenu2expand PmWiki.Documentation Index:) on Main.HomePage. If you would want to have this node expanded while you're visiting any page in the PmWiki group, place that directive in the PmWiki.GroupHeader page, for example.
- Initial release
- Cookbook.ExpandingMenu which served as a base for this recipe
- Cookbook.ExpandingMenus which shows a way to do the same without a plugin
See discussion at ExpandingMenu2-Talk