Well, I think it could work. If the slug match with the first regular expression, it will call the StartupsController... if it doesn't, it will check the second expression... if it match, the controller called will be the PeopleController.
I don't know if the regular expressions I used are correct, it was just an example.
Att,
--
Desenvolvedor Web
2012/8/30 42startups <hello@42startups.com>
HiSo I have two controllers: Startups and PeopleBut I'd like a direct slug to link to either.eg:domain.com/TehEpicStartup - should go to startups->viewdomain.com/DisPersonIsKewl - should go to people->viewIs 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.
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:
Post a Comment