Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generic path to a module in Magento

Tags:

magento

Is there a generic way to receive the path to a Magento module? I want to link to an configuration file in the /etc folder in one of my modules.

like image 958
powtac Avatar asked Mar 31 '11 09:03

powtac


2 Answers

You can ask for paths with getModuleDir method

Mage::getModuleDir('Model', 'Your_Extension');
Mage::getModuleDir('Block', 'Your_Extension');
Mage::getModuleDir('Helper', 'Your_Extension');
Mage::getModuleDir('controllers', 'Your_Extension');
Mage::getModuleDir('etc', 'Your_Extension');
like image 61
Anton S Avatar answered Oct 06 '22 00:10

Anton S


getModuleDir only works where the first parameter is 'etc', 'controllers', 'sql', or 'locale'. Of course, you could just pass in a '' as the first parameter and append 'Model'/'Block'/'Helper' to the returned value.

like image 28
user649650 Avatar answered Oct 06 '22 00:10

user649650