On Mon, Feb 16, 2009 at 5:46 PM, Miles J <[email protected]> wrote:
>
> Yes but I tried adding the :id in the route, but it didnt work. Heres
> the current code.
>
> The reason for both id/slug(title) is that previously it was based on
> id, and that would be a lot of links to go through and change.

How many views do you have? Anyway, if you use the last example I
posted, the regexp would match either a slug or id ('[a-zA-Z0-9_-]+')
and you can use is_numeric() to determine what was passed to the
action.

> Router::connect('/games/view/:title-:id', array('controller' =>
> 'games', 'action' => 'view'), array('pass' => array('id', 'title'),
> 'id' => '[0-9]+', 'title' => '[a-zA-Z0-9_-]+'));

Is this the only route? Because your older links would never match
this, either. I'm not even certain that Cake can handle something like
":title-:id" in a route.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to