# Module File Structure
Before starting the development of a module you must know the file structure of the module. Many files and folders are used in the modules for different purposes. Below are the files and folders of which a module can consists of -
. ├── config.xml ├── classes ├── controllers │ ├── admin │ └── front ├── logo.png ├── logo.gif ├── module_name.php ├── override ├── themes │ └── theme_name │ └── modules ├── translations ├── upgrade ├── views │ ├── css │ ├── img │ ├── js │ └── templates │ ├── admin │ ├── front │ └── hook
Module's Main file. This file must have the same name as the module's root folder's name.
Configuration file for the cache. This file does not exist in the module's folder. It is generated while module installation automatically.
# logo.gif and logo.png
Image files to represent the module in the back-office. Your module should have both the icon files
This folder contains class which manage object models and utility functions
This folder contains the Controller files. You can use the same sub-folder paths as for the View files.
- controllers/admin : Subfolder for back-office controller.
- controllers/front : Subfolder for front controller.
All files for overriding QloApps core files. If you want to change QloApps core files then you must not change the files and use overriding for this purpose. For instance, /modules/my_module/override/classes/Cart.php extends the default CartCore class.
For a basic module, the first three are necessary -
- Main file
- The cache configuration file (autogenerated by QloApps while installation)
- The icon file.
This folder contains module translation files used to display module content in multiple languages for example fr.php, en.php, es.php, etc.
Subfolder for upgrade files. When a module has a new version to release the older version may need an upgrade of its data or files. It can be done using this folder.
- views/templates: Template files of the modules resides in the folder.
- views/templates/admin: Subfolder for back-office controller's template files.
- views/templates/front: Subfolder for front controller's template files.
- views/templates/hook: Subfolder for module's hooks template files
- views/css: Subfolder for all the CSS files used in the module.
- views/js: Subfolder all the JS files used in the module.
- views/img: Subfolder for all the image, icon files used in the module.
The module can work with the above three files. All the other files and folders can be used if necessary.
In case any library is to be used in the modules it can be put in a separate folder i.e. 'lib', 'libs', 'libraries', 'sdk', 'vendor', 'vendors'. You should select the name which is most appropriate for the folder.