Created
March 11, 2012 22:26
-
-
Save gabrielslau/2018453 to your computer and use it in GitHub Desktop.
Exemplo de uso de Rotas com o CakePHP
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 | |
Router::connect( | |
'/projetos/:categoria' , | |
array('controller' => 'projetos', 'action' => 'index'), // Local à ser redirecionado | |
array('pass' => array('categoria'), 'categoria' => '[a-zA-Z-0-9_]*') | |
); | |
Router::connect( | |
'/projetos/:categoria/:codigo' , | |
array('controller' => 'projetos', 'action' => 'view'), // Local à ser redirecionado | |
array('pass' => array('codigo'), 'categoria' => '[a-zA-Z-0-9_]*', 'codigo' => '[a-zA-Z-0-9_]{7}') | |
); | |
Router::connect( | |
'/projetos/:categoria/:codigo-:titulo' , | |
array('controller' => 'projetos', 'action' => 'view'), // Local à ser redirecionado | |
array('pass' => array('codigo'), 'categoria' => '[a-zA-Z-0-9_]*', 'codigo' => '[a-zA-Z-0-9_]{7}', 'titulo' => '[a-zA-Z0-9_-]*') | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment