I added admin controller.
This code works correct:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<mycompany_mymodule>Mycompany_Mymodule_Adminhtml</mycompany_mymodule >
</modules>
</args>
</adminhtml>
</routers>
</admin>
If I add before=”Mage_Adminhtml” to mycompany_mymodule:
<mycompany_mymodule before="Mage_Adminhtml">Mycompany_Mymodule_Adminhtml</mycompany_mymodule >
then it doesn’t work – got 404 error.
1. What does this option do?
Also I looked throught Alans’ Storm article: http://alanstorm.com/magento_admin_controllers
There are example:
<config>
<!-- ... -->
<admin>
<routers>
<the_name_of_this_element_is_not_important_it_should_be_unique>
<use>admin</use>
<args>
<module>Alanstormdotcom_Adminhelloworld</module>
<frontName>adminhelloworld</frontName>
</args>
</the_name_of_this_element_is_not_important_it_should_be_unique>
</routers>
</admin>
<!-- ... -->
</config>
2. What is the difference between these definitions?
It solved:
I found
Mage_Core_Controller_Varien_Router_Standardclass wherecollectRoutes()method is defined. It parses “after” and “before” parameters to order the modules.This method is calling from
Mage_Core_Controller_Varien_Router_Admin(started frominitmethod inMage_Core_Controller_Varien_Front).So after I looked through match process in
Mage_Core_Controller_Varien_Router_Standard.After
Mage_Core_Controller_Varien_Router_Standarddebuging I understood my fault.I used Index controller instead of
MyModuleContoller.Alan Storm defined controller which is not under the admin module (i.e. adminhtml). When I use first config – it works perfect because I defined new modules under the section adminhtml. In Alan’s config I cannot add my module to adminhtml. I could override it but it is not correct because other modules under the adminhtml will be removed then.
This is correct code for menu under the
adminhtml:Inchoo also described this config here.