Modular Separation

Derek Jones edited this page Jul 5, 2012 · 85 revisions
Clone this wiki locally

[size=4]Update 17/09/2010: Modular Separation has been merged into Modular Extensions.[/size]

Modular Extensions adds HMVC aspects to your modules which means you can load controllers from other controllers which Modular Separation did not support. To continue using modules in the same way as in Modular Separation simply do not use or include the MX/Controller or extend from MX_Controller, just use the old Controller in the same way.


Modular Separation allows you to use modules for code organization in your application while only using a single controller per request. Instead of placing all of your controllers, models and views in the same folders you can have a "module" for each section of your site then place the MVC elements in there. This is known as Modular MVC.

You should be able to take any CodeIgniter application and place it into a module and it should work without alteration. However routes might need altering to allow for the added separation of a module.


  • Modules can be stored in several locations by modifying MY_Router.php
  • Each module may contain a config/routes.php file where routing and a default controller can be defined for that module. The default controller should be set using $route['module_name'] and NOT $route['default_controller'].
  • $route['404_override'] can be set in application/routes.php to send all 404 requests to a certain module.
  • Controllers may be loaded from application/controllers.
  • Controllers may also be loaded from module/controllers.
  • All module controllers are accessible from the URL via module/controller/method or simply module/method if the module and controller names match.
  • You can still use _remap() in your controllers

Module Directory Structure



The repository is gone, but you can use Modular Extensions 5.3 to run the exact same codebase.


Forum thread

Developed by: wiredesignz