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
When it comes to setting up routes like this, I use a config file. As a preference, I use XML to store my config data, however these could just as easily be stored in another supported format. I then add the routes from the config, to the router in my bootstrap.
Config:
:module/:id
index
index
:module/:controller/:id
index
:module/:controller/:action/:id
index
index
Bootstrap
$config = new Zend_Config_Xml('config.xml');
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addConfig($config, 'routes');
Obviously, there are other options and I'd encourage you to read the documentation on this, however, this fits for your example.