Skip to content

Instantly share code, notes, and snippets.

@tonysm
Created August 30, 2012 11:36
Show Gist options
  • Save tonysm/3526814 to your computer and use it in GitHub Desktop.
Save tonysm/3526814 to your computer and use it in GitHub Desktop.
router and regular expressions
<?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