It would be nice if I could do a find() within the routes.php file and then assign a controller based on the result. But alas.
-- I think I'll just have a top-level slug for one of the models.
Thanks anyway!
Cheers
On Thu, Aug 30, 2012 at 9:46 PM, Tony Messias <tonyzrp@gmail.com> wrote:
If you use different constants on your slug, like "DisPersonIsKewl " or "TehEpicStartup", I think you can do it with regular expression.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,--Luiz Antonio S Messias
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.
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