Generic path to a module in 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.

2 thoughts on “Generic path to a module in Magento”

  1. 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');
    

  2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *