I have defined a custom route in order to capture a parameter in the middle
of a URL.
So '/vendor/test/foo/bar' would translate to:
Module - vendor
Controller - foo
Action - bar
Value - test
I initially tried the following:
protected function _initRoutes()
{
// Get Front Controller Instance
$front = Zend_Controller_Front::getInstance();
// Get Router
$router = $front->getRouter();
$route = new Zend_Controller_Router_Route(
'vendor/:value/:controller/:action',
array(
'module' => 'vendor',
'action' => 'index',
'value' => 'username'
)
);
$router->addRoute('test_route', $route);
return $router;
}
Which seemed to give the desired result. However, once I have arrived at
the URL, all my zend_navigation URL's insert the literal part of the custom
route. i.e. the home link now ends with \vendor. So once at that URL, no
links work to allow navigation back to the default controller.
Also tried with the pattern 'vendor/test/:controller/:action' to no avail.
I have figured out a workaround, by specifying the default route for each
element added to zend_navigation, but it seems that this should not be
required. Surely the default route should be the ... well ... default
unless I specify otherwise?
Any help would be appreciated.