If you don't want to put an action before name-of-collection you'll need to create a route for each action, AFAIK.
Router::connect('/showcases', array('controller' => 'showcases', 'action' => 'index')); Router::connect('/showcases/edit/*', array('controller' => 'showcases', 'action' => 'edit')); etc. Router::connect('/collections/:slug', array('controller' => 'collections', 'action' => 'view'), array('slug' => '[-_A-Za-z0-9]+') ); On Sun, Dec 7, 2008 at 5:56 AM, Filip Camerman <[EMAIL PROTECTED]> wrote: > > I'm making a site for an artist and when showing image galleries of > art collections I want url's like > > www.site.com/collections/name-of-collection > > Now I also have a database table for collections, and hence a > collection_controller and a collection model. > > First I had my routes like this > - Router::connect('/collections/:action/*', array('controller' => > 'collections')); > - Router::connect('/collections/*', array('controller' => > 'collections', 'action' => 'index')); > > I thought that the first route would only catch url's with existing > actions, but instead it also caught my "/collections/name-of- > collection" url's. So I changed it to: > > - Router::connect('/coll/:action/*', array('controller' => > 'collections')); > > since the url's don't matter for my admin actions. But then I have to > change my forms because > > <?= $form->create('Collection');?> > > will post the form to /collections/... > > Now I can solve this in several ways (change the model name; make > separate routes for all my admin actions, ...) but I was wondering if > there's an elegant way to deal with custom url's that start with a > controller/model name? > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---