I recently had to get the frontname of a module programatically for the purposes of adding the frontname to Magento’s sitemap. In the case of this module the URL was dynamic so could not be statically added.
1 |
Mage::getConfig()->getNode('frontend/routers/[router node in config.xml]/args/frontName')->asArray(); |
For example :
1 |
$url = Mage::getConfig()->getNode('frontend/routers/mymodule/args/frontName')->asArray(); |
Where your config.xml file looks like this :
1 2 3 4 5 6 7 8 9 |
<routers> <mymodule> <use>standard</use> <args> <module>Namespace_Modulename</module> <frontName>myfrontname</frontName> </args> </mymodule> </routers> |