Menu Component

Including a menu

A menu is a module/widget which can be included in a page via the page_o.modules collection and can be referenced in an hmtl page using the location or position in the template or by module type. Where the IF condition is true $module = menu module

<!--#4DEACH $module in page_o.modules--> A collection of modules allocated to the page
<!--#4DIF($module.position="menu")--> the module with a location or position = menu or via type if only one menu on the page. 
<!--#4DIF($module.type.module="mod_menu")-->

 
Current Menu Data

The current menu JSON example of $page_o.menu object. To include any data from the object in a template use  page_o.menu.....

"UID": "0ECA664524767A428A2D9F7EA5C0072E",
"menutype": "mainmenu",
"title": "Desktop CMS",
"alias": "desktop-cms",
"path": "features/desktop-cms",
"published": 1,
"level": 2,
"params": {
    "pagination": "Page",
    "count": 10,
    "count_excerpt": 5,
    "article_order": "title asc",
    "category_order": "title asc",
    "tag_order": "title asc",
    "image_path": "",
    "image_class": "",
    "link_class": "",
    "include_empty": false,
    "max_level": 0,
    "include_children": false
},
"lft": 11,
"rgt": 23,
"home": 0,
"linktype": "Single Article",
"class": "",
"showmenu": 1,
"breadcrumbs": {
    "breadcrumbs": [
        {
            "title": "Features",
            "class": "",
            "path": "",
            "active": false,
            "home": 0
        },
        {
            "title": "Desktop CMS",
            "class": "",
            "path": "",
            "active": false,
            "home": 0
        }
    ]
},

Menu Module

For a menu modules represented as follows:

<!--#4DEACH $module in page_o.modules-->
<!--#4DIF($module.position="menu")-->

<ul class="navbar-nav">
    <!--#4DEACH $menu in $module.menu--> The menu items for the menu module

Menu List

The menu items are represented by the $module.menu collection. The sort order is the same as the menu in YouDoCMS GUI. Example of single level menu in the footer of  this page.

<!--#4DEACH $module in page_o.modules--> Loop through modules
<!--#4DIF($module.position="footer-b")--> If the module is in the footer its the menu 

<ul class="list-unstyled mb-0">
    <!--#4DEACH $menu in $module.menu--> Each menu item

    <li><a href="/<!--#4DTEXT $menu.path-->">
            <!--#4DTEXT $menu.title--></a></li>

    <!--#4DENDEACH-->
</ul>

<!--#4DENDIF-->
<!--#4DENDEACH-->