Monday, September 15, 2008

Tricky Routing Problem

Hey Guys,

I am creating a new system with a large collection of products. The
URLs currently work like this

/products/view/this-is-a-product/101

Everything works fine but I would like the URLs to be of the form:

/products/this-is-a-product/101

I have added this to the Router:

Router::connect('/products/*/([0-9].*)', array('controller' =>
'products', 'action' => 'view'));

This works just fine but the issue is I have several other actions in
the products controller and all these are being caught by the * in the
route. So things like /products/add/101 are being routed to the view
action.

Does anyone know of a way to fix this without explicitly excluding all
of my current actions. Id like to be able to add new actions to my
controller without having to change the routing.

Any help would be much appreciated.
Long Live CakePHP :)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: