36 public function forward($initialControllerInstance,$controllerName,$actionName,
$params=NULL){
38 $controllerName=strtolower($controllerName);
41 $ci->{$controllerName}->{$actionName}($params);
42 $result=ob_get_contents();
55 public function controller($controller, $name =
'', $db_conn = FALSE){
56 if (\is_array($controller)){
57 foreach ($controller as $babe){
58 $this->controller($babe);
62 if ($controller ==
''){
67 if (($last_slash = strrpos($controller,
'/')) !== FALSE){
69 $path = substr($controller, 0, $last_slash + 1);
71 $controller = substr($controller, $last_slash + 1);
78 if (in_array($name, $this->_my_controllers, TRUE)){
83 if (isset($CI->$name)){
84 show_error(
'The controller name you are loading is the name of a resource that is already being used: '.$name);
86 $controller = strtolower($controller);
87 foreach ($this->_my_controller_paths as $mod_path){
88 if ( ! file_exists($mod_path.
'controllers/'.$path.$controller.
'.php')){
91 if ($db_conn !== FALSE && ! class_exists(
'CI_DB')){
92 if ($db_conn === TRUE){
95 $CI->load->database($db_conn, FALSE, TRUE);
97 if ( ! class_exists(
'CI_Controller')){
98 load_class(
'Controller',
'core');
100 require_once($mod_path.
'controllers/'.$path.$controller.
'.php');
101 $controller = ucfirst($controller);
102 $CI->$name =
new $controller();
104 $this->_my_controllers[] = $name;
107 show_error(
'Unable to locate the controller you have specified: '.$controller);