I have a ZF app with several modules as this: ( as usual )
root\
\application\
\default
\items
\me
\controllers
\views
The application uses the default routing like /module/controller/action
;
What I want is this: if no match has been found for the default Zend Routing (no action / controller / module has been found ) then route to a desired path with the url endpoint spitted into parameters.
For example:
mydomain.lh/me
-> will match the moduleme
, controllerindex
, actionindex
( as default )mydomain.lh/my_category_name
-> will match the moduleitems
, controllerindex
, actionindex
,params
: category => my_category_name -> using the desired path route- no
my_category_name
module exists to match against
- no
I have tried with this, into bootstrap.php:
public function _initRoutes ()
{
$router = $this->_front->getRouter(); // returns a rewrite router by default
$router->addRoute(
'cat-item',
new Zend_Controller_Router_Route('/:category',
array(
'module' => 'items',
'controller' => 'index',
'action' => 'index'))
);
}
Witch points to the correct location ( I know because I var_dump -ed the request url into the items/index/index
action and the expected url and parameters were there, but if I do not do var_dump(something);exit;
into the action, a blank page is served.
- no output is made but also no error is generated, the request status is 200 - OK
Can anybody have a suggestion ?
Thank you!