When working with one module, although only specifying a single router in config.xml, it is possible to use the adminhtml.xml file to specify "routes" (note the quotation marks) (in the form of menu items) in the <action/> tag, which will then point to a subsequent controller file.

For instance, if you declare the following in your module's adminhtml.xml file:

<namespace_module_coolfunction translate="title" module="namespace_module">
    <title>Cool Function</title>

When Magento's adminhtml (or standard) router tries to match this route & controller, it will find the Namespace_Module's CoolfunctionController.php file. Because no action is defined, it will fall back to the default indexAction() method, which can be defined within said controller file.

Is this method frowned upon - and if so - are there detrimental effects of hosting a single module with multiple controller files?

1 Answer 1


For me this is perfectly valid. If the menu item is for a specific controller then simply ignore the action part and let the default take place.

You do have to think about what a controller should and should not contain or how to split up your controllers but that is mostly down to your own thinking.

So for example if you have a module that is simply for a single model. Here I would split the controllers into two.

  1. Single actions against the model. So here you would have your view, save and delete for individual items,
  2. Multiple actions against the model. So here you would have your list and mass actions.

Though this is simply my thinking behind the matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.