1

Ok, so so far I have gotten /admin/helloworld to show up using my module's /etc/config.xml:

<config>
<module>
    <VMR_Reports>
        <version>1.0</version>
    </VMR_Reports>
</module>
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <module1 before="Mage_Adminhtml">VMR_Reports_Adminhtml</module1> <!-- Namespace_Module_Subdirectory -->
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
</config>

But I don't understand everything that is going on in that example.

1) I know I'm configuring a route, but why ? I'm pretty sure isn't a frontName since there is a method of doing this sort of thing where your admin section stuff for a module actually goes into the route, "/module/admin/..." which uses the following sort of XML:

<admin>
    <routers>
        <modulename_admin>
            <use>admin</use>
            <args>
                <module>NameSpace_Modulename</module>
                <frontName>modulename_admin</frontName>
            </args>
        </modulename_admin>
    </routers>
</admin>

So it seems more like here is a logical section. Can someone please explain what is going on in the first block of code a little? All I know is that the result of it is that I get /admin/controller/action to show up where I can specify _Adminhtml if I want to put stuff into Adminhtml subdirectories.

7
  • 3
    Based on the last/all 6 questions you've posted being related to adminhtml routing and controllers, and the quality of the questions, I would highly recommend you take the time to go through the Fundamentals of Magento Development put out by Magento U. There is an introductory offer where you can get this course free after registering. This is a Q&A site, not a personal coaching site to avoid actual training, and this sort of activity shows a real lack of effort on your part.
    – davidalger
    May 15, 2013 at 18:49
  • will certainly take a look, but imo a lot of the docs basically say, do x,y, and z to do what you want without explaining why or what's really going on.
    – user2045
    May 15, 2013 at 19:07
  • For example, when I read the dev docs here: magentocommerce.com/knowledge-base/entry/… talking about a config file for feeding a controller's action a parameter, it says, "Don't worry too much about the specifics right now, but notice the <frontName>catalog</frontName> This is what links a Module with a URL frontname." I wanna know more specifics.......
    – user2045
    May 15, 2013 at 19:18
  • 1
    I took the course above (the same session as the video was taken), and it goes into more in depth of why things are done a certain way. Magento was built in Zend Framework so you need to learn how that Framework is built. It seems that you are new to Magento and new to coding in general. The documents are written in a language that the reader knows coding to a extent. If they went and outlined everything, you would essentially be reading a Encyclopedia instead of an article.
    – kab8609
    May 15, 2013 at 19:22
  • 1
    This might be of help to you markshust.com/2011/03/23/… May 15, 2013 at 19:25

1 Answer 1

5

Well, I'll chime in, since I'm the guy from the Magento U video.

Nothing controller-related works without router configuration, which is the use, args/module, and args/frontName paths under admin/routers and frontend/routers. What these xpaths do is essentially connect the specified module's controllers directory to a frontName, allowing a request to be routed to an action in the controller.

Evaluation of the args/modules (note the s) path was introduced in Magento 1.3. It allows modules to add additional controller directories under extant frontNames. It's my contention that the Adminhtml module would not be the horrid aggregation that it currently is if this mechanism had existed from 1.0. Module controllers had to be under Mage/Adminhtml/controllers/ in order to use the admin frontName. For more information, see the 1.2 version of Mage_Core_Controller_Varien_Router_Standard::collectRoutes() and compare it to the 1.3+ version

The Admin router and Standard router both share the collectRoutes() method, meaning that what works for one works for the other. Therefore, there's generally nothing technically wrong with adding additional frontNames to the Admin router. However, there could be issues with admin cookie path and perhaps some funky stuff in the corner which would make me want to follow Magento's example, which is to use the args/modules mechanism to add directories under the Adminhtml module's frontName.

2
  • 3
    +1 for actually answering instead of downvoting and harping.
    – philwinkle
    May 15, 2013 at 20:59
  • Yes, thank you. Pointing me to the php code was very instructive.
    – user2045
    May 15, 2013 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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