Magento Module Structure

Magento use MVC strcture for modules. MVC is accronym for Model View Controller .

Every MVC framework use concept that “A request for any resource (URL) is passed through controller, controlller process the request Use Model for manipulation of data, Create View and send it as response”

Typical architecture of MVC dataflow as seen in image below :

MVC-Process.svg

Magento modules have structure as below.

img1

Block : It deals with view part of modules. aceess model and create view .

controllers : contains controllers classes and actions. process request

etc : This folder configuration for modules such as, Block class path,router name etc.

Helper: This section is used to create basic methods that is used across modules.

Model : Contains business logic and used to process database part.

sql : use to handle database tables used in modules and module up gradation.

Details description of each directory will be available in next article.

Basics

Describe Magento codepools

Magento use to organize code in 3 codepools core,community and local.Location of each pool type are put into app/code diretory. While declaring modules we declare it’s code pools for example

<?xml version="1.0"?>
<config>
         <modules>
                <ERS_Slider>
                        <active>true</active>
                        <codePool>community</codePool>
                </ERS_Slider>
         </modules>
</config>

For above code declaration we need to put our modules in app/code/community directory.

Code Reference : See function getModuleDir in file app/code/core/Mage/Core/Model/Config.php
Note : Your module must reside at defined codepool in order to load module configurations correctly.