How to implement HMVC in codeigniter 3.0?
Asked Answered
B

4

11

Currently I'm using codeigniter version 3.0. I want to know how to implement HMVC structure in it, can anyone help?

Befool answered 16/6, 2015 at 11:13 Comment(1)
download hmvc from github.com/Crypt/Codeigniter-HMVC follow the steps mentioned "Modular Extensions installation" steps on readme.md file. i hope it will be solve ur issue.Phillipp
C
16

codeigniter 3 hmvc modules folder for:

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

1- Download files and copy C.i.3.0 forder in application

2- .htaccess

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

3- create /application/modules

4- /application/modules/welcome create in controllers, models, views

5- Create /application/modules/welcome/controllers/Welcome.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Welcome extends CI_Controller {

    public function index()
    {
        $this->load->view('welcome_message');
    }
}

enjoy :)

IMPORTANT : 'controllers' and 'models' initials files in the folder should be large. 'views' of files per folder in the letter should be small

enter image description here

Carvel answered 23/6, 2015 at 16:19 Comment(2)
Link is dead nowSuperlative
New Link: github.com/brianwozeniak/codeigniter-modular-extensions-hmvcCarvel
T
5

1 Step : Download
https://github.com/Crypt/Codeigniter-HMVC/tree/master/core Copy MY_Loader.php , MY_Router.php

paste in

application/core

directory

2 : step Download https://github.com/Crypt/Codeigniter-HMVC/tree/master/libraries

MX folder

Paste in

application/third_party

3 :Step modules/routes.php

$route['default_controller'] = 'index.php/Home/Home/index';

4: step create new folder (Home) in directory application/modules

5: step application/modules/Home in new Folder (controllers ,models,views)

Directory Structure e.g.

__application

__modules

 __Home

    __controllers

       __Home.php 

    __modules

       __home.php

    __views

       __home.php

6 : step application/modules/Home/controllers in (Home.php)

<?php
class Home extends MY_Controller
{
    function __construct()
    {
        parent::__construct();
    }

public  function index()
    {
        echo "WELOME TO HERE";
    }




}

?>
Took answered 3/6, 2016 at 7:33 Comment(2)
I think under modules/home/model folder will be there note modules/home/module . correct me if I am wrong.Fasces
we can keep model folder outside modules folder (which is already present)Emmanuelemmeline
S
0

You can use the template to understand how to use HMVC in codeigniter. You can also use the Rest-API with HMVC Module.

Download the full HMVC module:

https://github.com/salimmansoori1994/full_ci_set

Semiporcelain answered 21/12, 2019 at 19:21 Comment(0)
K
0

Use the new version from here. https://github.com/N3Cr0N/HMVC

original source not updated since many years and it gives errors.

Installing process is there on readme file.

Keverne answered 28/2, 2020 at 9:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.