I use this to dynamically generate a menu from my controllers and
functions during development.  Just replace the existing response.menu
assignment in menu.py in your app's 'models' folder:

import os
from gluon.myregex import regex_expose
ctldir = os.path.join(request.folder,"controllers")
ctls=os.listdir(ctldir)
if 'appadmin.py' in ctls: ctls.remove('appadmin.py')
response.menu = []
for ctl in ctls:
    if ctl.endswith(".bak") == False:
        filename = os.path.join(ctldir,ctl)
        data = open(filename, 'r').read()
        functions = regex_expose.findall(data)
        ctl = ctl[:-3]
        response.menu.append([ctl.capitalize(), False, '#',
            [[f.capitalize(), False,URL(request.application,ctl,f)]
for f in
    functions]])



On Sep 3, 4:19 pm, eddwinston <[email protected]> wrote:
> I am very very new to web2py and I love it. I am trying to have a
> dynamic side bar/side bar menu. How can I do that? Do I have to create
> a view and then pass in value from all the controller actions in the
> app?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to