Magento: Module Development Tip – External Files

When creating a module (extension) in Magento, if you are doing anything at all with design or skin files, you know that there’s no way to put those files within your main module directory. If you are like me, you don’t like that fact. I wish my module could all be housed inside one directory, but at this point it can’t. To help with this, I typically create a text file withing the root of my module’s directory like this: app/code/local/Prattski/MyModule/externalfiles.txt

Here I list out every file and it’s path that does not reside in my module directory. This not only helps you not forget what files belong to the module, but also make it easy to remove everything should you need to fully uninstall it. Here is an example:

### Module Files Outside this Directory
# Module XML File
# Frontend Templates
# Skin Files

I would encourage everyone who writes modules to get in this habit. It is not only very useful for yourself, it is also really helpful for any of you creating community extensions to include this so that whoever is installing the files can easily see all that belongs to the module if any modifications need to happen.

This entry was posted in Magento. Bookmark the permalink.

5 Responses to Magento: Module Development Tip – External Files

  1. ratheepan s says:

    hi, this is the great idea.

  2. Nice idea, I will try to do it :-)

  3. Hi,
    thanks for the tip. If you are using Magento 1.5 (or above), I’d suggest using the Magento Connect Manager for that instead. You can have your list of files there, plus the possibility to generate a package. You can not only update it to MagentoConnect (you don’t need to), but you can easily extract it to another server or install it on a different Magento instance with a few clicks. And once you have done it once and got used to it, you are as fast as writing a text file.

  4. Snowcore says:

    Great idea! Will try to do the same :)

  5. Kamil says:

    Good point! Also it helps when module was not installed by Magento Connect Manager but just copied and has to be deleted. No need to search all design directories. I think I will start to do that with my modules.