How can I shorten the definition of my custom routes in Zend Framework? I currently have this as definition:
$route = new Zend_Controller_Router_Route(
\":mo
I prefer to use *.ini files over XMLs especially when using Zend since it's more Zend-like and much more light-weight and compact. Here's an almost similar configuration using Zend_Config_Ini()
.
application.ini
[routes]
routes.shortcutone.route=:module/:id
routes.shortcutone.defaults.controller=index
routes.shortcutone.defaults.action=index
routes.shortcutone.reqs=\d+
bootstrap.php
$config = new Zend_Config_Ini('application.ini', 'routes');
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addConfig($config, 'routes');
Take note that the [routes]
section in the application.ini
file can be renamed. And when it is renamed, the second parameter of Zend_Config_Ini()
should reflect the new section title.