Magento Files And Folders Structure
This tutorial will provide the detailed information regarding Magento’s default files and folders structure. As we all know that the Magento is based on MVC structure in PHP language. Magento uses Zend framework as a base library. Magento has very powerful, simple, flexible and defined directory structure.
Here, we will discuss top level directory of the Magento and will explore the depth of sub-directories. In this tutorial, we will name “root” where our Magento is installed.
The default files and folders included in the main directories are as following.
There are some folders or directory on Magento root:
1) app
2) downloader
3) errors
4) includes
5) js
6) lib
7) media
8) pkginfo
9) shell
10) skin
11) var
There are some files on Magento root:
1) .htaccess
2) .htaccess.sample
3) api.php
4) cron.php
6) favicon.ico
7) get.php
8) index.php
9) index.php.sample
10) install.php
11) LICENCE.txt
12) mage
13) php.ini.sample
14) RELEASE_NOTES.txt
Further in this tutorial, we will discuss every root level directory of Magento:
1) App directory in Magento:
App directory is very important role in the Magento. It contains all application development related files. Word “app” comes from word application.
This directory contains following type of files:
- Configuration files related to Magento application like database, modules, core and theme files.
- All modules
- Design and theme related files
- Language related files.
# app directory: It has following 4 sub directories:
- Code
- Design
- Etc
- Locale
## /app/code directory: It is the directory for the development. It has following sub-directories:
- core
- local
- community
In core directory contains all Magento core modules with mage namespace.
In local directory contains all locally developed modules, means if we are customizing any core module then we can create own module in /app/code/local/ module.
In community directory contain module installed by Magento connect.
# /app/design directory: This is directory for designer. It contains all design related files of the admin and frontend interface. It has 3 sub directories:
- frontend
- adminhtml
- install
# /app/etc directory: It is primarily contains xml files. These xml files contains all configuration related information of our store like database etc. In this directory, local.xml for configuration for database.
# /app/locale directory: This directory contains the language related file. For example, if you have two running store for language, then we will create locale for every language.
2) Downloader directory:
It is related to Magento files downloading. It is used to install the extension from Magento connect. This is used for the installation and upgrade of Magento through our browser.
3) errors directory:
It is contains different error processor and template files like 404 error. Usually people do not touch this directory.
4) includes directory:
It contains some middleware code files. All model files parsed and moved into this folder. Once you made any changes in our module’s model file then it first parsed and moved into this folder.
5) js directory:
It contains the pre-compiled libraries of the javascript code included in Magento. for example, extjs, prototype.js, tiny_mce etc.
6) lib directory:
It contains all php library used in Magento.
7) media directory:
This is storage of the Magento media files like images, generated thumbnails, uploaded products images. It is also used the container for importing images through csv or mass import/export tools. It also contains dynamic images in third party modules.
8) skin directory:
Skin folder contains like images, javascript files, CSS files, flash files and also include the skin files for installation of skins and administration templates. But in skin folder only contains media related to the design of the frontend and backend area. Skin folder has 3 main sub directories:
- skin/frontend
- skin/ adminhtml
- skin/ install
9) var directory:
Var directory play important role in Magento. It is contains mainly temporary files and data like cache, error, log, session and locks.
Hope now we have clear understanding of Magento directory structure.