Magento – Get frontName of admin from app/etc/local.xml

adminadmin-controllerattributesmagento-1.9xml

<admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[admin]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>

How can I get the front Name of my admin, to use it in code like this ->

$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false, 'files_browser_window_url' => $this->getBaseUrl() . '(there must be frontname)/cms_wysiwyg_images/index/')); 

Best Answer

You can read directly from config file such as app/etc/local.xml with:

Mage::getConfig()

Thus you can use the following:

Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');

However, instead of doing this I reckon you should use the helper that lets you generate admin URLs:

Mage::helper("adminhtml")->getUrl("adminhtml/cms_wysiwyg_images/index/");
Related Topic