function auto_load_controller() { require_once LIBRARY_DIR . "router.php"; $router = new Router(); $controller = $router->get_controller(); $controller_dir = $router->get_controller_dir(); $format = $router->get_format(); $params = $router->get_params(); $this->load_controller($controller, $controller_dir, $format, $params); }
function auto_load_controller() { // load the Router library and get the URI require_once LIBRARY_DIR . "Router.php"; $router = new Router(); $this->selected_controller_dir = $controller_dir = $router->get_controller_dir(); $this->selected_controller = $controller = $router->get_controller(); $this->selected_action = $action = $router->get_action(); $this->selected_params = $params = $router->get_params(); $this->load_controller($controller, $action, $params); }
*/ load_helper('base_url'); /* * Load system */ require SYSPATH . 'router.php'; require SYSPATH . 'loader.php'; require SYSPATH . 'controller.php'; require SYSPATH . 'model.php'; require SYSPATH . 'library.php'; require SYSPATH . 'i18n.php'; /* * Understand URL and decompose route */ $router = new Router(empty($_SERVER['PATH_INFO']) ? '' : $_SERVER['PATH_INFO']); $controller = $router->get_controller(); $method = $router->get_method(); $args = $router->get_args(); /* * Load requested controller */ $not_found = true; $controller_file = APPPATH . 'controllers/' . $controller . '.php'; if (file_exists($controller_file) && is_readable($controller_file)) { include $controller_file; $a = new $controller(); if (method_exists($a, $method)) { $not_found = false; call_user_func_array(array($a, $method), $args); } }