Hi folks,

After some refinement, I use this way to define menus in my default.py

    # At the beginning of my default.py
    response.automenu=[ # Such as
[('func_name1','menu_name1',absolute_url1), ...]
        ('tutor0','Tutorial 0',URL(r=request,f='tutor0')),
        ('tutor1','Tutorial 1',URL(r=request,f='tutor1?param=foo')),
        ('tutor2','Tutorial 2',URL(r=request,f='tutor2')),
        ('tutor3','Tutorial 3',URL(r=request,f='tutor3')),
        ('example','Advanced Examples...',URL
(r=request,c='example',f='index')),
      ]
    response.menu=[[menu,(func==request.function),absurl] # you don't
need to change this
      for func,menu,absurl in response.automenu]

The result is that, whatever action(function) mentioned in
response.automenu, is automatically represented as a menu item in the
rendered view, and the active function will have an outstanding look.

To Massimo:
Do you think it is convenient to add this line into the core of
web2py, to make the support of response.automenu official?

    response.menu = [[menu,(func==request.function),absurl]
        for func,menu,absurl in response.automenu
        ] if response.automenu else response.menu # fall back

Of course, the example above does not address the hierarchical menu
yet. But you get the idea.

Sincerely,
             Ruijun Luo, 2009-Jan-17, 23:40(PM), Sat


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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