Created
December 13, 2013 17:32
-
-
Save enlacee/7947987 to your computer and use it in GitHub Desktop.
Configuracion de router, statatic, dinamico y expre-regulares
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 | |
// 11111 | |
// $frontController = Zend_Controller_Front::getInstance(); | |
// $router = $frontController->getRouter(); | |
// $route = new Zend_Controller_Router_Route( | |
// 'copitan', | |
// array( | |
// 'module'=>'default', | |
// 'controller' => 'anb', | |
// 'action' => 'index' | |
// ) | |
// ); | |
// $router->addRoute('test', $route); | |
// 22222 | |
// $frontController = Zend_Controller_Front::getInstance(); | |
// $router = $frontController->getRouter(); | |
// $route = new Zend_Controller_Router_Route( | |
// 'usuario/:nombre', | |
// array( | |
// //'nombre' => 'pepeluchoSeteado', | |
// 'module'=>'default', | |
// 'controller' => 'anb', | |
// 'action' => 'index' | |
// ) | |
// ); | |
// $router->addRoute('test', $route); | |
// 3333 | |
// $frontController = Zend_Controller_Front::getInstance(); | |
// $router = $frontController->getRouter(); | |
// $route = new Zend_Controller_Router_Route( | |
// 'usuario/:nombre', | |
// array( | |
// //'nombre' => 'pepeluchoSeteado', | |
// 'module'=>'default', | |
// 'controller' => 'anb', | |
// 'action' => 'index' | |
// ), | |
// array('nombre' => '\d+') | |
// ); | |
// $router->addRoute('test', $route); | |
// 444 staticas | |
// $route = new Zend_Controller_Router_Route_Static( | |
// 'login', | |
// array('controller' => 'anb', 'action' => 'index') | |
// ); | |
// $router->addRoute('login', $route); | |
// 555 EXPRECION REGULAR 01 | |
// $frontController = Zend_Controller_Front::getInstance(); | |
// $router = $frontController->getRouter(); | |
// $values = array( | |
// //'1' => '2006', | |
// 'controller' => 'anb', | |
// 'action' => 'index' | |
// ); | |
// $route = new Zend_Controller_Router_Route_Regex( | |
// 'archive/(\d+)',$values); | |
// $router->addRoute('archive', $route); | |
// 6666 EXPRECION REGULAR 02 variable dinamico | |
// $frontController = Zend_Controller_Front::getInstance(); | |
// $router = $frontController->getRouter(); | |
// $route = new Zend_Controller_Router_Route_Regex( | |
// 'archive(?:/(\d+))?', | |
// array( | |
// 1 => '2006', | |
// 'controller' => 'anb', | |
// 'action' => 'index' | |
// ) | |
// ); | |
// $router->addRoute('archive', $route); | |
$frontController = Zend_Controller_Front::getInstance(); | |
$router = $frontController->getRouter(); | |
$route = new Zend_Controller_Router_Route_Regex( | |
'archive/(\d+)', | |
array( | |
'controller' => 'anb', | |
'action' => 'index' | |
), | |
array( | |
1 => 'year' | |
) | |
); | |
$router->addRoute('archive', $route); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment