Loading...
 
Skip to main content

History: MultiLevelMenus

Preview of version: 6

Tikiwiki version: 1.8.5.

[-]


This solution is heavily based on initial work by xia (Forum postQuestion).

Let's say we want to have a menu that's collapsed by default. Upon expanding it should be like this:

Image


1. Open templates/tiki-admin_menu_options.tpl

Find:

Copy to clipboard
<option value="o" {if $type eq 'o'}selected="selected"{/if}>{tr}option{/tr}</option>


Add below:

Copy to clipboard
<option value="p" {if $type eq 'p'}selected="selected"{/if}>{tr}submenu1{/tr}</option> <option value="q" {if $type eq 'q'}selected="selected"{/if}>{tr}submenu2{/tr}</option>


('p', 'q', 'submenu1', 'submenu2' can be any names you choose)

Save and close.

2. Open lib/smarty_tiki/function.phplayers.php

Find:

Copy to clipboard
if ($cd["type"] == 'o' and $indented) { $output.= ".";


Add below:

Copy to clipboard
} elseif ($cd["type"] == 'p') { $output.= ".."; } elseif ($cd["type"] == 'q') { $output.= "...";


Save and close.

3. Click on 'Admin' menu and then 'Features'. Tick 'PhpLayers Dynamic menus' and press 'Change preferences' button.

4. Admin -> Menus. Create a new menu of 'dynamic collapsed' type. Configure the menu to add menu items.

Image


5. Admin -> Modules. Scroll down to 'Create new user module' section. Give it a name, title. The latest menu we just created should be selected for 'phpLayersMenus:' drop-down (not the regular menus dropdown). Click on 'use phplayermenu' and press 'create/edit'.

6. Assign the module to set it left or right at a desired order.

Image

Image

Image

Image

Top Menus

[-]


You can have multi-level top menus, too:

Image


Edit templates/tiki-top_bar.tpl and add the following as the last line:

Copy to clipboard
{phplayers id=43 type=horiz}


...where 43 is the number of the menu you want to display (on siridhar's Tiki install, 43 happens to be the 'SubMenus demo' menu ID). Maybe one day Tiki will have configurable top and bottom menus 🙄.

If your prefered theme overrides templates/tiki-top_bar.tpl (with a local copy in templates/styles/XXX/) and doesn't support dynamic top menus by default, you could ask the theme designer to add the feature, or do it yourself (edit the loal copy in the same way, putting the phplayers line at the bottom of the file).

Tikiwiki version 1.9

Sorry, this functionality isn't currently available in 1.9 due to the menu refactoring work

[+]

Live Demo

You can check siridhar's live demo at http://sridharkatakam.com/tiki/Question. (seems the link is nomore valid)

History

Information Version
Gary Cunningham-Lee Missing tree images can be found in 1.9.5 directory, not 1.9.4. 8
View
Gary Cunningham-Lee 1.9.4 procedure and new demo link added. 7
View
luci 6
View
Marc Laporte ading to category 5
View
Michael Davey 4
View
Michael Davey integrated my initial top menus notes into the document flow using siridhar's images 3
View
Michael Davey 2
View
Sridhar Katakam 1
View