Hi Folks! Thank you for yours answers!

In fact what a really want is to get db data from a previously defined
database on db.py.
I have a table there called "album" and I'd like to get those albums to
build a menu like on Maximo's example, but getting it from a table defined
on db.py.

Any ideas?

Tito

On Sun, May 17, 2009 at 11:47 PM, Jason Brower <[email protected]> wrote:

>
> 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
> > >
>
>
> >
>


-- 
Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______
Sent from Campinas, SP, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to