local is sometimes missing from the downloaded installation archive, as it is empty by default.
Let's take a deeper look at the community codePool for the default Magento installation as shown in the following diagram:
community/ └── Phoenix └── Moneybookers ├── Block │ ├── Form.php │ ├── ... │ └── Redirect.php ├── Helper │ └── Data.php ├── Model │ ├── Abstract.php │ ├── ... │ └── Wlt.php ├── controllers │ ├── MoneybookersController.php │ └── ProcessingController.php ├── etc │ ├── config.xml │ └── system.xml └── sql └── moneybookers_setup ├── install-22.214.171.124.php └── mysql4-upgrade-1.2-126.96.36.199.php
Phoenix folder is what is called the vendor namespace, and it usually matches your company identifier or something else unique to you. Within the
Phoenix folder there is a
Moneybookers subfolder that stands for your actual extension name.
There is a simple rule as to whether to choose
For example, let's imagine that our company name is
Foggyline and the extension we are building is called
. As we wish to share our extension with the community, we can put it into a folder such as
All the Magento core code is also divided into extensions, and is located under the
app/code/core/Mage folder. You should never place any of your code or edit any of the existing code under the
Let us get back to our example from the previous listing, the
Moneybookers extension. We can see that it has several subfolders within it:
Block: This folder contains various PHP classes. You can think of the Block folder as a placeholder for class objects that visually manifest themselves to the user on a frontend. Most of these PHP classes extend the
Mage_Core_Block_Templateclass from within the
app/code/core/Mage/Core/Block/Template.phpfile. These PHP classes are then linked to various layouts and template
*.phtmlfiles within the given theme under the
controllers: This folder contains various PHP classes. You can think of controllers as a glue between our URL actions, models, blocks, and views. Most of these classes extend the
Mage_Core_Controller_Front_Actionclass from within the
app/code/core/Mage/Core/Controller/Front/Action.phpfile or the
Mage_Adminhtml_Controller_Actionclass from within the
etc: This folder contains various XML configuration files such as
wsi.xml. Depending on what type of extension you are building, you might find some configuration files used more than the others.
Helper: This folder contains various PHP classes, most of which extend the
Mage_Core_Helper_Abstractclass from within the
Helperclasses contain various utility methods that will allow you to perform common tasks.
With that said, we will temporarily conclude our trip to the
app/code folder structure and move on to the
This folder is basically a starting point for every Magento extension. The following listing shows the default content of the
app/etc/modules folder for the default Magento installation, which is a collection of XML files:
For example, if we were to create our
Foggyline/Happy Hour extension, we would need to create a file
app/etc/modules/Foggyline_HappyHour.xml as we will show later on.
Next, we move onto the
app/local folder. This is where the translation files reside. If you were building an extension that would support multiple languages, for example English and German, you might want to create the following files: