latest
  • User Guide
  • Developer Guide
  • Cookbooks
  • Best Practices
  • Reference
    • Modules
    • Actions
    • Controllers
    • Filters
    • Tags
      • Built-in tags
      • Module tags
        • button
        • chart_pie
        • chart_pie3d
        • cotonic_pathname_search
        • debug
        • draggable
        • droppable
        • google_chart
        • inplace_textbox
        • lazy
        • live
        • loremipsum
        • mailinglist_subscribe
        • menu
        • pager
        • poll
        • script
        • sortable
        • sorter
        • spinner
        • tabs
        • validate
        • wire
        • wire_args
        • worker
    • Global template variables
    • Models
    • Validators
    • Notifications
    • Installation requirements
    • Configuration
    • Command-line
    • EDoc reference
  • Glossary
Zotonic
  • Docs »
  • Reference »
  • Tags »
  • menu
  • Edit on GitHub

menu¶

  • Module: mod_menu

Show a page menu.

This tag is part of the module mod_menu. The {% menu %} tag is used to generate the HTML for the menu defined in the admin.

You can define multiple menus in your site. By default there is one menu, called “main_menu”. If you want another one, create a page of type “page menu” (under “Categorization”) and start editing your menu. You can use the “menu_id” argument to select which menu you want to display.

Example:

{% menu id=id %}

Generates something like:

<ul id="navigation" class="nav">
  <li>
    <a href="/" class="welcome">Home</a>
  </li>
  <li>
    <a href="/features" class="page_features">Features</a>
  </li>
  <li>
    <a href="/documentation" class="documentation active">Documentation</a>
  </li>
  <li>
    <a href="/documentation/628/installation" class="page_install">Install</a>
  </li>
</ul>

The menu has the following features:

  • The menu is a unordered list.
  • The id of the menu is navigation and can be prepended with param id_prefix.
  • The class of the menu is set with param class (default nav).
  • Menu items are a <li> with a single <a>
  • The link of the menu item referring to the current page has the class active.
  • Every link also gets the unique name of the target as a class.
  • Every menu item can have single level submenus. A submenu has the same properties as the menu.
Argument Description Example
id Set this to the id of the current shown page and it wil highlight its page path.  
menu_id The id of the menu that you want to display. If left empty, the main menu is shown.  
id_prefix String prepended to menu id.  
class HTML class for the list; default “nav”.  
maxdepth Maximum depth of the menu; default 999.  
template Template to render the menu; default “_menu.tpl”  
Next Previous

© Copyright 2009–2017, The Zotonic Project (zotonic.com). Revision 316626c1.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.