Loading...
 

MultiLevelMenus

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:

Image


1. Open templates/tiki-admin_menu_options.tpl

At around line 34, find:

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


Immediately following that line, add these lines:

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, 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:

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


And add:

Copy to clipboard
} 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.

Image


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.

Image

Image

Image

Image

Page-top Horizontal Menus

[-]


You can have multilevel page-top horizontal 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.

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):

Image
Copy to clipboard
"r" => "sorted section",

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

Image
Copy to clipboard
"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).

Demo

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.


Page last modified on Thursday 24 August 2006 07:04:32 GMT-0000

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting