PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Using a Router

To properly use the rewrite router you have to instantiate it, add some user defined routes and inject it into the controller. The following code illustrates the procedure:

<?php
// Create a router

$router $ctrl->getRouter(); // returns a rewrite router by default
$router->addRoute(
    
'user',
    new 
Zend_Controller_Router_Route('user/:username',
                                     array(
'controller' => 'user',
                                           
'action' => 'info'))
);

Zend Framework