1

I have 2 modules: default and admin.

For default module I created custom and removed default routes because I don't want my web works with booth (custom and default). But I want to use default routes for admin module.

Can I set default routes only for one module ? how to do this in Zend Framework ?

If I set

$router->removeDefaultRoutes();

in bootstrap, my routes doesn't work for admin module. I use one Bootstrap.php file for booth modules.

tasmaniski
  • 4,767
  • 3
  • 33
  • 65

1 Answers1

1

Try to check current module:

if (Zend_Controller_Front::getInstance()->getRequest()->getModuleName() == 'default') {
    $router->removeDefaultRoutes();
}
Alex Pliutau
  • 21,392
  • 27
  • 113
  • 143
  • You can also overwrite the default route. – Liyali Feb 28 '12 at 17:33
  • Since the routing process is what determines the current module I'm not sure how this would work. – Tim Fountain Feb 28 '12 at 20:11
  • @tasmaniski - What do you mean by 'better'? garvey's solution seems as straightforward as you can get in Zend. – Mike Moore Feb 29 '12 at 03:20
  • @Mike If you think this is good answer why you didn't upvote ?? I mean without if() condition... garvey's solutions is good enough so approve and upvote from me. – tasmaniski Feb 29 '12 at 10:54
  • @tasmaniski I was not able to test garvey's solution, so I am not going to upvote it. I am not trying to be snarky, I am only pointing out that, if it works, garvey's solution looks very clean and readable. – Mike Moore Feb 29 '12 at 17:12