Path

ez.no / ezpublish / documentation / incoming / how does the new menu system work?


How does the new menu system work?

These documentation pages are no longer maintained. Please visit the new documentation site.

From eZ publish 3.4, it is possible to change menu style for the page layout of site. This document will explain how does it work.

The configuration file for menu, named menu.ini, can be found under folder settings. It contains the following blocks:

  • [MenuSettings] It uses array 'AvailableMenuArray' to define available menus.
  • [SelectedMenu] It has three variables: 'CurrentMenu', 'TopMenu' and 'LeftMenu'.
  • Several [$menuName] blocks depending on available menus. Here variable $menuName is the same as defined in 'AvailableMenuArray' of block [MenuSettings].

If you changed a menu, it is not this file that would be updated. Instead file settings/siteaccess/site/menu.ini.append.php will be updated. Note that only block [SelectedMenu] will be updated actually. For example, if you have changed menu to LeftTop, the block will looks like this:

[SelectedMenu]

CurrentMenu=LeftTop

TopMenu=flat_top

LeftMenu=sub_left

The value of parameter TopMenu and LeftMenu, defines which menu template is going to be used, are actually copied from block [LeftTop]. The menu template file flat_top.tpl or sub_left.tpl should be found in folder design/site/templates/menu.

The pagelayout should be dynamic with menu changes. If a menu has no left menu, the main content should take the left part. This can be solved using CSS, the following example illustrates how it works:

 {let maincontentstyle='maincontent-bothmenus'}

           {section show=eq(ezini('SelectedMenu','LeftMenu','menu.ini'),'')}

               {set maincontentstyle='maincontent-noleftmenu'}

           {/section}

 

           <div id="maincontent" class="{$maincontentstyle}">

           Main content

           </div> 

{/let}

In default, the main content style is set to 'maincontent-bothmenus'. By checking configuration file menu.ini, the main content style will be set to 'maincontent-noleftmenu' if no left menu is found. In the CSS file, a different left margin will be defined in div.maincontent-noleftmenu{ }.

Comments