Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Codeigniter HMVC MY Loader View Path Change
#1

[eluser]riwakawd[/eluser]
I have been working on codeigniter my loader view change so can shorten the length that can type.

But I would like to be able to have two options for my modules. I use hmvc and the modules I have are admin, catalog, install

For admin and install module to use

Code:
$this->_ci_view_paths = array(APPPATH . 'views/template/' => TRUE


And Catalog module to use this

Code:
$this->_ci_view_paths = array(APPPATH . 'views/theme/' => TRUE

I am not sure the best way to use one loader. But how I can use both locations. I am not sure if it will work I know it works for one only but would like to use 2.

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

/* load the MX_Loader class */
require APPPATH."third_party/MX/Loader.php";

class MY_Loader extends MX_Loader {

   function __construct() {
   if($this->_ci_view_paths = array(APPPATH . 'views/template/' => TRUE OR $this->_ci_view_paths = array(APPPATH . 'views/theme/' => TRUE);
   $this->_ci_ob_level  = ob_get_level();
   $this->_ci_library_paths = array(APPPATH, BASEPATH);
   $this->_ci_helper_paths = array(APPPATH, BASEPATH);
   log_message('debug', "MY_Loader Class Initialized");
  }
}
#2

[eluser]riwakawd[/eluser]
The best way to be able to choose view paths is to make it as an array. If use MX Codeigniter HMVC. It works fine I just have tested it out. For multiple paths that is. Or you can use just the one.

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

/* load the MX_Loader class */
require APPPATH."third_party/MX/Loader.php";

class MY_Loader extends MX_Loader {

    function __construct() {
        $this->_ci_view_paths = array(
            APPPATH . 'modules/install/views/template/' => TRUE,
            APPPATH . 'modules/admin/views/template/' => TRUE,
            APPPATH . 'modules/catalog/views/template/theme' => TRUE
        );
       $this->_ci_ob_level  = ob_get_level();
       $this->_ci_library_paths = array(APPPATH, BASEPATH);
       $this->_ci_helper_paths = array(APPPATH, BASEPATH);
       log_message('debug', "MY_Loader Class Initialized");
    }

}




Theme © iAndrew 2016 - Forum software by © MyBB