Shucks, you beat me to it!
On Sun, 2009-05-17 at 19:32 -0700, mdipierro wrote:
> Yes, I think some like this should do it.
>
> db.define_table('menu_item',
> SQLField('name'),
> SQLField('link'),
> SQLField('position','integer'),
> SQLField('parent','integer',default=0))
>
> def menu(table=db.menu_item):
> items=table._db(table.id>0).select(orderby=table.parent|
> table.position).as_list()
> parent=0
> p={0:[]}
> for item in items:
> p[item.id]=[]
> p[item.parent].append([item.name,True,item.link,p[item.id]])
> return MENU(p[0])
>
> {{=menu(db.menu_item)}}
>
>
>
>
> On May 17, 8:23 pm, Tito Garrido <[email protected]> wrote:
> > Hi...
> >
> > How can I use DB data on menu?
> > I'd like to use db data to build a submenu on menu.py...
> >
> > Thanks!
> >
> > Tito
> >
> > --
> > Linux User #387870
> > .........____
> > .... _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:_______
> > Sent from Salvador, BA, Brazil
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---