Return to Snippet

Revision: 24131
at February 21, 2010 19:16 by asterfr


Initial Code
/**
* Add this in your bootstrap
*/
protected function _initRoutes() {
    
            $ctrl = Zend_Controller_Front::getInstance();
            $router = $ctrl->getRouter();
            //match every call on http://ZEND_ROOT/aZ2s-Ty9
            $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);
        }

Initial URL

                                

Initial Description
You have to add this code in your Bootstrap

Initial Title
Zend Router simple extension through simple regex

Initial Tags
url, php

Initial Language
PHP