Thursday, August 30, 2012

One slug route connected to multiple controllers?

Hi

So I have two controllers: Startups and People

But I'd like a direct slug to link to either.

eg:
domain.com/TehEpicStartup - should go to startups->view
domain.com/DisPersonIsKewl - should go to people->view

Is there an easy option here, or do I need to create a separate controller, or should I just go with the default domain.com/startups/TehEpicStartup and domain/people/DisPersonIsKewl ??

In routes.php:

Router::connect(
   '/:slug', 
   array(
       'controller' => 'startups', 
       'action' => 'view'
       ), 
   array(
    'slug' => '[a-zA-Z0-9_-]+'
   )
);


Cheers! 

--
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: