Cake PHP Routing issue
Posted
by Smickie
on Stack Overflow
See other posts from Stack Overflow
or by Smickie
Published on 2010-04-28T13:49:48Z
Indexed on
2010/04/28
13:53 UTC
Read the original article
Hit count: 320
Hi, I need to do some special routing in cake, but can't for the life of me figure it out.
I have a shop controller at /shop
, the format of the url will be:
/shop/:category/:sub_category/:product_slug
In the routing I need to send each part of the url to a different action, for example if the url was just /shop/cakes
it would go to the category action of shop.
However if the url was /shop/cakes/macaroons
or /shop/cakes/fairy
it would go to the sub category action on the shop controller.
And the the same again for /shop/cakes/macaroons/pistachio
would go to the product action on the shop controller.
How would I go about this in the routing? Something starting with
Router::connect('/shop/:category/:sub_category/:product_slug' ...
Or am I way off the mark? Thanks.
© Stack Overflow or respective owner