在codeigniter中的loader.php上。我希望我的模块能够设置自己的视图路径,我似乎无法使其与所有三个路径一起工作。
我怎样才能最好地发挥作用。它目前仅适用于一条路径。
<?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);
$this->_ci_view_paths = array(APPPATH . 'modules/admin/views/template/' => TRUE);
$this->_ci_view_paths = array(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");
}
}
当前
<?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);
$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");
}
}
答案 0 :(得分:0)
能够选择视图路径的最佳方法是将其设置为数组。如果使用MX Codeigniter HMVC。它工作正常我只是测试了它。
<?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");
}
}