Skip to content

Instantly share code, notes, and snippets.

@TiuTalk
Forked from gabrielslau/rotas.php
Created March 11, 2012 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiuTalk/2018508 to your computer and use it in GitHub Desktop.
Save TiuTalk/2018508 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: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