This article about how to setup Hierarchical Model-View-Controller (HMVC) on CodeIgniter 2.1.2. Here we go the step how to seting up on CodeIgniter 2.1 :
- Download wiredesignz HMVC zip file from bitbucket.org.
- Extract the files from the zip.
- Move all of the files from the newly extracted folder’s
./core/
directory to CodeIgniter’s/application/core/
directory on your server. - Move the
MX
directory and all of its files from the newly extracted folder’s./third-party/
directory to CodeIgniter’s/application/third-party/
directory on your server. - Going to application folder and create the new one folder called /application/modules/
- Add the following to your
/application/config/config.php
file on your server:
$config['modules_locations'] = array( APPPATH.'modules/' => '../modules/', );
How to test ? like usual you do with CI. Dont forget to create the Hierarchical Folder like bellow:
/application/modules/module_name/
/application/modules/module_name/controllers/
/application/modules/module_name/models/
/application/modules/module_name/views
If you feel this tutorial to short, you can try this file on your desk. This is a package CodeIgniter 2.1.2 with HMVC , you can download this file.
Enjoy and happy coding!