Zend router config xml, shortcut?
I have an xml like this
<configdata>
<routes>
<home type="Zend_Controller_Router_Route">
<route>home</route>
<defaults>
<controller>index</controller>
<acti开发者_如何学Goon>index</action>
</defaults>
</home>
</routes>
</configdata>
Now this works but I'd like to give each rout a shortcut like you would add in bootstrap like this..
$router->addRoute('shortcut_key',$route);
How can I do this in the config xml?
On your bootsrap.php...
protected function _initRoutes()
{
$routefile = new Zend_Config_Xml(APPLICATION_PATH.'/routes.xml');
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addConfig($routefile);
return $router;
}
where routes.xml file is the xml file containing all routes and it must be inside your application folder
精彩评论