Created
April 21, 2013 07:49
-
-
Save devyfriend/5428814 to your computer and use it in GitHub Desktop.
Codeigniter .... application/core/MY_Loader.php, ability do add / edit "views" folder location, good for themes, dynamic "views" location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(){ | |
parent::__construct(); | |
} | |
/** Load a module view **/ | |
public function view($view, $vars = array(), $return = FALSE) { | |
list($path, $_view) = Modules::find($view, $this->_module, 'views/'); | |
if ($path != FALSE) { | |
$this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths; | |
// | |
$view = $_view; | |
} | |
// hackery to apply application/themes/theme_name/views folder | |
$_theme = config_item('theme_current'); | |
if($_theme) { | |
$_path = APPPATH.'themes/'.$_theme.'/'.$this->_module.'/views/'; | |
$this->_ci_view_paths = array($_path => TRUE) + $this->_ci_view_paths; | |
} | |
return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment