Tag Archive for route

Zend Router simple extension through simple regex

/**
* Add this in your bootstrap
*/
protected function _initRoutes() {
    
            $ctrl = Zend_Controller_Front::getInstance();
            $router = $ctrl->getRouter();
            //match every call on <a href="http://ZEND_ROOT/aZ2s-Ty9" >http://ZEND_ROOT/aZ2s-Ty9</a>
            $route = new Zend_Controller_Router_Route_Regex('([a-zA-Z0-9]+-[a-zA-Z0-9]+)',
                array(
                    //dispatch this to the VController
                    'controller' => 'v',
                    // iAction()
                    'action'     => 'i'
                    ),
                array(
                    //send the captured value has the "e" parameters of the request
                    1 => 'e'
                    )
            );
    
            //give a name to your route and add it to the default router
            $router->addRoute('view',$route);
        }

source

Advanced Admin Routing in Cake

if(($routing_admin = Configure::read("Routing.admin")) !== null) {
$name = str_replace($routing_admin.'_', $routing_admin.DS, $name);
}

source