abu abu
abu abu

Reputation: 7022

config.xml file of Magento extension

I got the below code in a config.xml file of a Magento extension.

<admin>
    <routers>
        <brandlogo>
            <use>admin</use>
            <args>
                <module>Mconnect_Brandlogo</module>
                <frontName>brandlogo</frontName>
            </args>
        </brandlogo>
    </routers>
</admin>

I would like to know what the <frontName> tag is?

Upvotes: 0

Views: 107

Answers (1)

scrowler
scrowler

Reputation: 24405

All Magento extensions that expose controller routes need to define a frontname. In this particular example, it's an adminhtml controller, and the frontname is "brandlogo".

This means that if you go to /index.php/admin/brandlogo/index the Magento admin router will route your request to the Mconnect_Brandlogo's IndexController, i.e. Mconnect_Brandlogo_IndexController::indexAction.

If the <area> was frontend rather than admin, this is how you would define frontend (customer facing) routes.


Please be aware that this way of configuring admin routes is deprecated. There were security issues found with it (such as that you could type in "yourstore.com/brandlogo" and be shown the admin login page), and have now been replaced with the "new way" of routing admin modules:

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Mconnect_Brandlogo before="Mage_Adminhtml">Mconnect_Brandlogo_Adminhtml</Mconnect_Brandlogo>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

Using this configuration you'd also store your controllers under the Adminhtml folder of "controllers", e.g.:

# File: app/code/community/Mconnect/Brandlogo/controllers/Adminhtml/IndexController.php

class Mconnect_Brandlogo_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
{
   // ...
}

For more information, have a look at the ridiculousness that was caused by the Magento SUPEE-6788 security patch last year.

Upvotes: 3

Related Questions