PHP expert |
|
Na wat hevig zoekwerk, ben ik eruit geraakt. Je kan de URL's aanpassen in de Zend_Controller_Router_Rewrite class. Dus jij wilt dat ipv /artikel/index/id/5 -> /artikel/id/5 wordt.
De volgende code moet in je bootstrap staan (index.php):
Zend_Loader::loadClass('Zend_Controller_Router_Rewrite');
Zend_Loader::loadClass('Zend_Controller_Router_Route');
//configure the router class
$route = new Zend_Controller_Router_Rewrite();
$route->addRoute( 'artikel' , new Zend_Controller_Router_Route('artikel/id/:id' , array( 'controller' => 'artikel' , 'action' => 'index') ) );
//set up the controller
$controller = $route->getFrontController();
//de router instellen
$controller->setRouter($route);
//de front controller configureren
$controller->setParam('noViewRenderer' , true);
$controller->setControllerDirectory( './application/controllers');
//run the conroller
$controller->dispatch();
Zend_Loader::loadClass('Zend_Controller_Router_Rewrite'); Zend_Loader::loadClass('Zend_Controller_Router_Route'); //configure the router class $route = new Zend_Controller_Router_Rewrite(); $route->addRoute( 'artikel' , new Zend_Controller_Router_Route ('artikel/id/:id' , array( 'controller' => 'artikel' , 'action' => 'index') ) ); //set up the controller $controller = $route->getFrontController(); //de router instellen $controller->setRouter($route); //de front controller configureren $controller->setParam('noViewRenderer' , true); $controller->setControllerDirectory( './application/controllers'); //run the conroller $controller->dispatch();
Je kan dus met $route->add(...); nog meer custom routes toevoegen.
Informatie hierover vind je o.a. op de twee onderstaande links.
http://framewor...outer.html
http://jeffreys...-framework/ |