Tikiwiki version: 1.8.5.


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

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


1. Open templates/tiki-admin_menu_options.tpl

At around line 34, find:

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

Immediately following that line, add these lines:

<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, but must be consistent in each of the files edited.)

Save and close, or upload if the files are being edited remotely from the server.

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

At around line 72, find:

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

And add:

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

Save and close or upload.

3. If PHP Layers menus are not already activated, 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, or open an existing menu of that type to add sublevels to. Configure the menu to add menu items.


Note that the menu preview on this page will not display the new sublevels since the preview is a standard Tiki menu and the sublevels are enabled by PHP Layers.

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

6. Assign the module to the left or right column, in the desired position.





Page-top Horizontal Menus


You can have multilevel page-top horizontal menus, too:


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

{phplayers id=43 type=horiz}

...where 43 is the number of the menu you want to display.

If your prefered theme overrides templates/tiki-top_bar.tpl (with a theme-specific tiki-top_bar.tpl in templates/styles/XXX/) and doesn't already include the tag for a PHP Layers menu, ask the theme designer to add the feature, or do it yourself by editing a local copy of the file, adding the phplayers tag to the file).

Tikiwiki version 1.9+


(This procedure has been tested with Tiki 1.9.4.) Edit templates/tiki-admin_menu_options.tpl and lib/smarty_tiki/function.phplayers.php as described in steps 1. and 2, above.

In lib/menubuilder/menulib.php find the following line (near line 126):

"r" => "sorted section",

...and add the following two lines immediately after:

"p" => "submenu1",
"q"=> "submenu2",

Save and close or upload to the server.

The lib/phplayers/images/tree_collapse_corner_first.png or other PHP Layers Menu image files for tree-style menus may be missing from the Tiki installation (v.1.9.4). If so, upload the images from tiki-1.9.5(CVS) /lib/phplayers/menuimages/ to the server's /lib/phplayers/images/ directory. Overwriting all files will result in new, improved tree menu images (better appearance on dark backgrounds).


A multilevel menu has been made at zukakakina.com (currently Tiki 1.9.4) using this procedure. View a theme that uses a PHP Layers menu — such as Sev Dravid (vertical-style menu tag in a template), Planetfall, Snow or Zuka.