Menu Manager

Menu Manager is a module for abstracting menus into a system that's easily usable and customizable. It abstracts the display portion of menus into smarty templates that can be easily modified to suit the user's needs. That is, the menu manager itself is just an engine that feeds the template. By customizing templates, or make your own ones, you can create virtually any menu you can think of.

This module has the capability to cache its output into static files to reduce memory requirements and sql queries, and to improve frontend performance. This provides all the advantages of static menus without the inconvenience involved when creating or editing pages. Each menu template can be marked as "Cachable". When a cachable menu template is used on a content page that is cachable, any cached menu output that is available for this page will be used. The nocache parameter on the menu tag can be used to completely disable caching. All cached menu files are erased when a content item is added, edited, or deleted... and also when a menu template is added/edited or deleted.

MenuManager is not only used to display navigational structure of the Website but comes also with Sitemap or Breadcrumbs capabilities. This means that you can use MenuManager registered Smarty tags {cms_breadcrumbs} or {site_mapper} to display Breadcrumbs menu or a Sitemap.

   Parameters

  • collapse - Turn on (set to 1) to have the menu hide items not related to the current selected page.
  • loadprops - Use this parameter when NOT using advanced properties in your menu manager template. This parameter will disable the loading of all content properties for each node (such as extra1, image, thumbnail, etc). This will dramatically decrease the number of queries required to build a menu, and increase memory requirements, but will remove the possibility for much more advanced menus
  • items - Use this item to select a list of pages that this menu should display. The value should be a list of page aliases separated with commas.
  • number_of_levels - This setting will only allow the menu to only display a certain number of levels deep. By default the value for this parameter is implied to be unlimited to show all levels of children. Except when using the items parameter, in which case number_of_levels is implied to be 1 unless overridden.
  • show_all - This option will cause the menu to show all nodes even if they are set to not show in the menu. It will still not display inactive pages however.
  • show_root_siblings - This option only becomes useful if start_element or start_page are used. It basically will display the siblings along side of the selected start_page/element.
  • start_level - This option will have the menu only display items starting a the given level. An easy example would be if you had one menu on the page with number_of_levels='1'. Then as a second menu, you have start_level='2'. Now, your second menu will show items based on what is selected in the first menu.
  • start_element - Starts the menu displaying at the given start_element and showing that element and it's children only. Takes a hierarchy position (e.g. 5.1.2).
  • start_page - Starts the menu displaying at the given start_page and showing that element and it's children only. Takes a page alias.
  • template - The template to use for displaying the menu. Templates will come from the database templates unless the template name ends with .tpl, in which case it will come from a file in the MenuManager templates directory (defaults to simple_navigation.tpl)
  • excludeprefix - Exclude all items (and their children) who's page alias matches one of the specified (comma separated) prefixes. This parameter must not be used in conjunction with the includeprefix parameter.
  • includeprefix - Include only those items who's page alias matches one of the specified (comma separated) prefixes. This parameter cannot be combined with the excludeprefix parameter.
  • childrenof - This option will have the menu only display items that are descendants of the selected page id or alias. i.e: {menu childrenof=$page_alias} will only display the children of the current page.
  • nocache - Disable any caching of this call to the menu. This parameter, if set to any positive value will override any settings in the content object and the menu template.
  • root - Applicable only to the breadcrumbs action, allows specifying a start level that is not the default page.
  • action - Specify the behavior of the module. There are two possiblities for this parameter:
    • default (default) - Used for building a navigation menu.
    • breadcrumbs - Used to build a breadcrumb trail to the currently displayed page. Note: {cms_breadcrumbs} is a short way of calling this action.

   Examples

Only show the menu div when there are child pages.

{menu start_level='2' assign='menu_there'}
{if $menu_there}
   <div id="submenu">
      <h3>Submenu</h3>
      {menu start_level='2'}
   </div>
{/if}

   Template parameters

The parameters for the $node object used in the template are as follows:

  • $node->id
    Content ID
  • $node->url
    URL of the Content
  • $node->type
    Content type, possible values: sectionheader, separator, feu_protected_page
  • $node->accesskey
    Access Key, if defined
  • $node->tabindex
    Tab Index, if defined
  • $node->titleattribute
    Description or Title Attribute (title), if defined
  • $node->hierarchy
    Hierarchy position, (i.e. 1.3.3)
  • $node->depth
    Depth (level) of this node in the current menu
  • $node->prevdepth
    Depth (level) of the node that was right before this one
  • $node->haschildren
    Returns true if this node has child nodes to be displayed
  • $node->children_exist
    Returns true if this node has child nodes available in the database that can be displayed in the menu
  • $node->menutext
    Menu Text
  • $node->raw_menutext
    Menu Text without having html entities converted
  • $node->alias
    Page alias
  • $node->extra1
    This field contains the value of the extra1 page property, unless the loadprops-parameter is set to NOT load the properties
  • $node->extra2
    This field contains the value of the extra2 page property, unless the loadprops-parameter is set to NOT load the properties
  • $node->extra3
    This field contains the value of the extra3 page property, unless the loadprops-parameter is set to NOT load the properties
  • $node->image
    This field contains the value of the image page property (if non empty), unless the loadprops-parameter is set to NOT load the properties
  • $node->thumbnail
    This field contains the value of the thumbnail page property (if non empty), unless the loadprops-parameter is set to NOT load the properties
  • $node->target
    This field contains Target for the link (if non empty), unless the loadprops-parameter is set to NOT load the properties
  • $node->created
    Item creation date
  • $node->modified
    Item modified date
  • $node->index
    Count of this node in the whole menu
  • $node->parent
    True if this node is a parent of the currently selected page
  • $node->current
    True if this node is the currently selected page
  • $node->first
    exists, and set to 1 if is the first item in a level
  • $node->last
    exists, and set to 1 if is the last item in a level

To see some working examples, you can import the accessible_simple_navigation menu template in your database.