I've read the cake book and a few blog posts about this but I'm still
not 100% on this.
I have set up sluggable behaviour, so that everything is given a
unique slug from the name, and I append a ".html" extension on the
end.
I'm now playing around with the routing, but I'm not getting the
results I'm looking for.
Hypothetically lets say I have a controller called "posts".
I would like the following URLs for each action:
/posts/ - gives the index action.
/posts/$slug/ - gives the view action (where slug is the post slug).
/posts/new/ - gives the add action.
/posts/edit/$id - gives the edit action (where id is the id of the
post).
So far I have:
Router::connect('/posts/', array('controller' => 'posts',
'action' => 'index')); // works fine.
Router::connect('/posts/new/', array('controller' =>
'posts', 'action' => 'add')); // works fine
I have managed to get /tips/view/$slug/ with the following:
Router::connect('/tips/', array('controller' => 'tips',
'action' => 'view')); // works fine
However, I would really like to remove the view from there, because I
don't think it is necessary...
I have tried the following and these were my results:
Router::connect('/tips/*', array('controller' => 'tips', 'action' =>
'view')); // works, but messes up "add" view.
Router::connect('/tips/:slug/', array('controller' =>
'tips', 'action' => 'view')); // same result.
I can understand why it interferes, because it is assuming anything
after tips/ must be a slug name, but I'm not sure what I can do to
avoid it. I'm sure there must be some way.
Apologies, that was quite a long winded way of putting it - but I
would appreciate any help!
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---