Setup HMVC with Codeigniter 3.0

codeigniter_logo

Follow below steps to setup HMVC in codeigniter(CI):

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/downloads

1. Download zip from above URL and copy them into application folder of CI

2. Rewrite HTACCESS

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

3. Create folder called “modules” in application folder i.e. application/modules

4. Create a folder of particular module in modules folder. For e.g. application/modules/admin

5. Create controllers, models and views folder in particular module. For e.g.  in application/modules/admin module

6. Create controller file controllers folder of particular module. For e.g.  application/modules/admin/controllers/Admin.php

<?php

defined(‘BASEPATH’) OR exit(‘No direct script access allowed’);

class Admin extends CI_Controller {

    public function index() {

        $this->load->view(‘admin/dashboard’);

    }

}

7. Following will be the structure:

hmvc-structure

That’s it…

Extras: Addicted Upcoming

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s