Magento Expert Forum - Improve your Magento experience

Results 1 to 2 of 2

Magento directory structure

  1. #1
    Junior Member rocker's Avatar
    Join Date
    Mar 2013
    Posts
    105
    Thanks
    3
    Thanked 11 Times in 9 Posts

    Cool Magento directory structure

    In order to continue Magento Tutorial this week, I will lead you to Magento directory structure. Please follow it carefully! Magento is built based on the principle of object-oriented programming with MVC architecture. The code system of Magento is saved in the form of dispersions so as to increase extension ability for the system. The directory structure is stored as the followings: I - Magento directory structure
    II – The structure of module
    1. The best way to understand Magento is to know structures and activities of modules in Magento. The entire code of one module is contained in a directory in app/code/core/Mage 2. The following is the structure of a module catalog: You must use article before a singular noun: a/the/my…

    • Block: monitors the template system in Magento. The code in block is used to load database and display of template. This is also the location to edit database if necessary before showing it on the template. The display of which template will be declared in the layout file: app/design/frontend/default/default/layout/your_module.xml

    For example:







    When clients access the link: http://domain.com/yourmodule/index/index, Magento will analyze this URL to find out names of module, controller and action which are called out. And then, it will search in layout files to view the template which will be used to display
    Here is the file yourmodule/yourtemplate.phtml

    • Etc: contains XML files which are used to configure each module. There are three important files:


      • * Config.xml: directly configures module and declares Module, Resource, Block, and Helper…

    * System.xml: configures default value and display in admin menu.
    * Adminhtml.xml: creates menu in admin.

    • Model: handles the process of the database access. Magento designs database according to the EAV model so the database access is quite complicated. This is the place to write functions which directly carry out queries.
    • Controllers: define process to execute request of users. Controllers are classes which inherit from the basic one: Mage_core_Controller_Varien_Action (inherits from class Zend_Controller_Action).
    • Helper: you can add functions here in order to do anything as you wish. To call one function (Ex: helper Test) in Helper, you need to use the command below: Mage::helper(‘yourmodule/yourhelp’)->helperTest();
    • Sql: contains files to setup database for module which interact with database (create table, update tables…)
    • Besides, there are layout and template files for admin and frontend in the folder: app/design/adminhtml/default/default and app/design/frontend/default/default.
    • To declare Magento a new module you need to create a XML file Yournamespace_Yourmodule.xml




    true
    local




    III – Question
    1. What is the compilation mode in Magento?
    The mode inserts class files into a folder in order to speed up in Magento. In order to use this function, you need to go to menu system->website->compilation in admin.
    2. Then entering the link below into the Address bar of browser, which Module, Controller and Action will Magento call?
    URL: http://domain.com/action/module/controller
    a. Module: module Controller: controller Action: action
    b. Module: action Controller: controller Action: module
    c. Module: action Controller: module Action: controller
    After following this post, can you please give the correct answer for this question?
    Hope for your answer much!

    View more threads in the same category:


  2. #2
    Administrator david's Avatar
    Join Date
    Nov 2012
    Posts
    261
    Thanks
    22
    Thanked 42 Times in 34 Posts

    Default

    You rock !!!

Similar Threads

  1. Magento Files and Folders Structure
    By jaredovi in forum Programming & Development
    Replies: 5
    Last Post: 18-12-2021, 07:58 AM
  2. Check Size of a Directory in Linux Tips
    By david in forum PHP programming
    Replies: 2
    Last Post: 22-04-2019, 07:56 AM
  3. Protect a Directory Using .htaccess
    By david in forum PHP programming
    Replies: 1
    Last Post: 14-03-2019, 07:23 AM
  4. Could not determine temp directory, please specify a cache_dir manually
    By shunavi in forum Programming & Development
    Replies: 1
    Last Post: 19-06-2013, 01:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •