Created
August 30, 2012 11:36
router and regular expressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// first route | |
Router::connect( | |
'/:slug', | |
array( | |
'controller' => 'Startups', | |
'action' => 'view' | |
), | |
array( | |
'slug' => '[0-9A-Za-z_-]+Startup', //just an example | |
'pass' => array ('slug') | |
) | |
); | |
//second route | |
Router::connect( | |
'/:slug', | |
array( | |
'controller' => 'People', | |
'action' => 'view' | |
), | |
array( | |
'slug' => '[0-9A-Za-z_-]+Person[0-9A-Za-z_-]+', //just an example | |
'pass' => array('slug') | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment