Anthony you champion! thank you so much!! I can not believe that I
have been scratching my head for so long over something so simple
hehe. thanks again mate :)

On Oct 24, 10:54 am, Anthony <abasta...@gmail.com> wrote:
> On Sunday, October 23, 2011 6:47:45 PM UTC-4, noremac wrote:
>
> > On Oct 24, 7:42 am, Christopher Steel <chris...@gmail.com> wrote:
> > > Are you looking to generate navigation menu's using table data?
>
> > > If so, you can try a search for web2py "generate menu". Make sure to
> > check
> > > out the web2pyslices as well, I think one of the very first slices was
> > > related to creating dynamic menus.
>
> > Thanks for the reply mate but I already have the menu generating from
> > the table data. Im looking to make the menu work.  It is for an online
> > store selling many different products. For example.
>
> > Animal
> >     Dog
> >     Cat
> >     Bird
>
> > Animal is the main category and dog, cat and bird are subcategories.
>
> > When I click on Dog I would like to be able to pass animal and dog as
> > parameters to a function of some sort that will generate a query with
> > those parameters, something like this.
>
> > products = db((db.products.category=='animal') &
> > (db.products.subcategory=='dog')).select(db.products.all)
>
> def products():
>     products = db((db.products.category==request.args(0)) &
>         (db.products.subcategory==request.args(1)).select()
>     return dict(products=products)
>
> Then construct your menu so the links include the category and subcategory
> as arguments. For dogs, the link should be:
>
> URL('your_controller', 'products', args=['animal', 'dog'])
>
> Which will generate the URL /your_app/your_controller/products/animal/dog.
>
> Anthony

Reply via email to