Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Hi guys, its been 3years since i wrote this tutorial on how to create HMVC pattern using Codeigniter 2.1.4. You may check my old post for that.

Tutorial for HMVC Pattern Codeigniter PHP Framework

Due to insistent public demand, i decided to create a tutorial on how we can use HMVC pattern for Codeigniter 3.1.3

So for new developers that will just start to learn codeigniter, then this is a good start for you.


Intro: Why Codeigniter?

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

Framework Features:

  1. Framework with a small footprint
  2. Clear documentation
  3. Compatibility with standard hosting
  4. No restrictive coding rules
  5. Simple solutions over complexity
  6. Exceptional performance
  7. No large-scale monolithic libraries
  8. Nearly zero configuration
  9. No need for template language
  10. Spend more time away from the computer

Tutorials Data:

Let’s Start

STEP 1

  1. Download the latest version of codeigniter from their site link here. or you can download my codeigniter here. Fresh CodeIgniter3.1.3.zip
  2. Download the HMVC Modular Extension from Wiredesignz

STEP 2

  1. Open up your xampp/wamp (windows) or mamp (mac), then put your downloaded codeigniter 3.1.3 in your htdocs.. Once you view it in your browser you should see a welcome page, see the image below.
  2. Go to wiredesignz folder that you downloaded a while ago and inside of that folder you will see two folders and files inside.
Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

STEP 3

  • We need to copy the core folder files inside of our codeigniter folder in this path: /application/core/ . See the image below.
Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

 

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

  • Then, we need to copy the third_party folder inside of wiredesignz downloaded folder and copy to application/third_party folder . See the image below.
Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

  • Copy MX folder
  • Paste it inside codeigniter application third_party folder.

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

  • Then try to browse your localhost codeigniter. You will see that its still running properly.
  • And we’re done.

Question?

I encounter this error, when browsing the index page of codeigniter. what should i do?

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Error Message

Call to undefined method MY_Loader::ci_object_to_array()

My Face be Like?

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern


Solution

Open up your /application/third_party/MX/Loader.php  and find this line.

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern



and changed to

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

 

AND THATS IT, RUN AGAIN YOUR CODEIGNITER APPLICATION.

Tutorial for Codeigniter v3.1.3 and HMVC Pattern

Tutorial for Codeigniter v3.1.3 and HMVC Pattern


 

Implement HMVC Pattern.

 

  • Create new folder inside of your application, and named it “modules“. then you can create users module that will handle all about users login, profile, transaction etc.
Tutorial for HMVC Pattern Codeigniter PHP Framework

Tutorial for HMVC Pattern Codeigniter PHP Framework

 

  • To access your first hmvc module  in codeigniter, open up your xampp/wamp (windows) or mamp (mac). In my case,

     

    Tutorial for HMVC Pattern Codeigniter PHP Framework

    Tutorial for HMVC Pattern Codeigniter PHP Framework

     

If you want to access my old tutorial for codeigniter 2.1.4 you may visit this post Tutorial for HMVC Pattern Codeigniter PHP Framework

7927 Total Views 15 Views Today
Anthony Pillos

About Anthony Pillos

Developers.ph – We are Awesome. Tutorials in different programming languages like PHP,HTML5,JAVASCRIPT,CSS/CSS3,JQuery,Jquery Mobile, Responsive Design.

7928 Total Views 16 Views Today

2 comments

Leave a Reply to Kifni Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">