Tuesday, April 16, 2013

Confused about routing

Hi

I am trying to make a special route, but had no success so far. Could you help?

The url looks like:

/products/:category_slug/:product_slug

So, when "product_slug" isnt specified I would like to use

array('controller' => 'categories','action' => 'index')

and in the other case (when "product_slug" is specified):

array('controller' => 'products','action' => 'index')

For example:

/products/category_a should point to /categories/index/category_a

and (note the same category_slug)

/products/category_a/product_a should point to /products/index/category_a/product_a

Is this possible and could you provide an example?

Thank you very much,
Frank 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: