The menu
The navbar is divided into 3 parts:
- the brand
- the toggling area
- the link list
- additional search
Involved files are:
- masterdata/_init.php
- _header.php
- js/menu.js
- masterdata/js/masterdata.js
There are 3 possibilities to create a menu, defined by masterdata/_init.php, domain_menumode:
- 0: manuell _header.html
- 1: JavaScript js/menu.js
- 2: dialog, menu: Admin/Menu
Bootstrap navbar
The navbar is well explained on getbootstrap.
With menu.js
With a simple Javascript data structure the bootstrap menu can be generated automatically:
Change the menu and display it:
bootstrap navbar, data structure
The menu is stored in js/menu.js.
Additionally to a simple menu url, I use a pages array with the menu url. An Example for the datastructure:
- selector: "mynavi.navbar"
- html_li_simple
- html_li_dropdown
- pages:{}
- <pagename>
- url
- datadef
- login
- langchoice
- <pagename>
- menu:[]
- title
- ID (optional)
- condition: (optional, default: true) or a JavaScript expression
- href (optional)
- page (optional)
- target (optional)
- active_by (optional): "page"(default),"url","basename","none"
- li_class (optional)
- li_attributes (optional)
- a_attributes (optional)
- children[] (optional)
ID
The ID is helpful if you want to change, add or delete your menu structure for example for a special customer with JavaScript.
li_class="disabled"
With this class the link is displayed, but its not clickable.
condition
With a JavaScript expression, variables and functions are useable and define, if the menu item is displayed or not. Example for an Javascript expression:
- variable:
- var user_right=5;
- menu item with condition:
- "condition":"user_right==5"