Someone kindly help me understand the models/menu.py file’s following code:
response.menu = [
(T('Home'),False,URL('default','index')),
(T('About'),False,URL('default','what')),
(T('Download'),False,URL('default','download')),
(T('Docs & Resources'),False,URL('default','documentation')),
(T('Support'),False,URL('default','support')),
(T('Contributors'),False,URL('default','who'))
]
In this,we specify the controller in the URL(eg.default/what). What if I wish to specify a view in this?
In web2py, URLs don’t route directly to views. Rather, they route to controllers, and controllers have associated views (each controller has a default view, but the controller itself can specify any view). If you want to use the URL to tell a given controller to use a view other than it’s usual view, you can indicate that via an arg or var in the URL. For example:
and in the default.py controller: