>>> print MENU([['One', False, 'link1'], ['Two', False, 'link2']]) |
Sets the class of the outer UL elements.
Sets the class of the inner UL elements.
Sets the class of the inner LI elements.
Allows to add a class to the first list element.
Allows to add a class to the last list element.
MENU takes an optional argument mobile. When set to True instead of building a recursive UL menu structure it returns a SELECT dropdown with all the menu options and a onchange attribute that redirects to the page corresponding to the selected option. This is designed an an alternative menu representation that increases usability on small mobile devices such as phones.
Normally the menu is used in a layout with the following syntax:
{{=MENU(response.menu, mobile=request.user_agent().is_mobile)}}
# In this way a mobile device is automatically detected and the menu is rendered accordingly.
" Web2py Book - Chapter 5" is licensed under Creative Common License BY-NC-ND 3.0