11 $this->_my_controller_paths = array(APPPATH);
14 return site_url($url);
18 if(isset($this->ci)===
false){
19 $this->ci =& get_instance();
20 $this->ci->load->helper(
'url');
26 if(\array_key_exists(
"q", $view)===
false){
29 $view[
"q"][$identifier]=$content;
33 $view[$view_var]=$output;
36 public function forward($initialControllerInstance,$controllerName,$actionName,
$params=NULL){
38 $controllerName=strtolower($controllerName);
41 $ci->{$controllerName}->{$actionName}(
$params);
42 $result=ob_get_contents();
48 return $initialControllerInstance->load->view($viewName,
$params,
true);
52 return array_values($dispatcher->uri->segment_array());
55 public function controller($controller, $name =
'', $db_conn = FALSE){
56 if (\is_array($controller)){
57 foreach ($controller as $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);
__construct($params=array(), $injected=NULL)
forward($initialControllerInstance, $controllerName, $actionName, $params=NULL)
renderContent($initialControllerInstance, $viewName, $params=NULL)
createScriptVariable(&$view, $view_var, $output)
controller($controller, $name='', $db_conn=FALSE)
fromDispatcher($dispatcher)
addViewElement($identifier, $content, &$view)