How to implement HMVC in codeigniter

1

Hi, I am trying to integrate my CMS based on codeigniter 2.1.0 using this tutorial: link

But, I have a problem, I'm using this code in my application on the route ... app\core\MY_Loader.php :

<?php (defined('BASEPATH')) OR exit('No direct script access allowed');
class MY_Loader extends CI_Loader{
  function __construct()
  {
    parent::__construct();
  }
  public function view($view, $vars = array(), $return = FALSE) 
  {
    $nv = $view;
    $path = explode('/', $view);
    if($path[0] != 'default') {
      $file = str_replace('/', DIRECTORY_SEPARATOR, $view).'.php';
      if(! file_exists(VIEWPATH.$file)) { 
        $len = count($path); $i = 0;
        $path[0] = 'default';  $nv = '';
        foreach($path as $p) {
          if($i == $len - 1) {
            $nv .= $p;
          } else {
            $nv .= $p.'/';
          }
          $i++;
        }
      }
    }
    return $this->_ci_load(array(
      '_ci_view' => $nv, 
      '_ci_vars' => $this->_ci_prepare_view_vars($vars), 
      '_ci_return' => $return
    ));
  }

And this is the code provided by the tutorial in the file MY_Loader.php :

/* load the MX_Loader class */ 
require APPPATH."third_party/MX/Loader.php"; 
class MY_Loader extends MX_Loader {}

I really do not know how to implement HMVC for my application in this case, Thanks for your help!

    
asked by c3media 23.05.2017 в 20:59
source

0 answers