Skip to content

Instantly share code, notes, and snippets.

@gabrielslau
Created March 11, 2012 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gabrielslau/2018453 to your computer and use it in GitHub Desktop.
Save gabrielslau/2018453 to your computer and use it in GitHub Desktop.
Exemplo de uso de Rotas com o CakePHP
<?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