when use custome routes(default_controller & 404_override), meet some error
route setting:
$route['default_controller'] = 'home'; $route['404_override'] = 'home/dispatcher';
Default Home controller:
class Home extends CI_Controller { public function __construct(){ parent::__construct(); } public function index(){ $this->load->view('welcome_message'); } public function dispatcher(){ debug('xxx'); } }
Then make a dir 'example' and create a new empty controller Home, so, as CI3's features, this controller will be default controller of current dir. Let's visit the uri example/something, the 'something' method is not exist,so the default 404 route 'home/dispatcher', should be active,but it's meet error:
Message: call_user_func_array() expects parameter 1 to be a valid callback, class 'Home' does not have a method 'dispatcher' Filename: core/CodeIgniter.php Line Number: 514
You said it:
this controller will be default controller of current dir
When you're under the example/ directory, it's example/Home.php that will be used.
I'm currently on the same boat. i can't change "default_controller" that exist on subfolder on CI3.
config.php $route['default_controller'] = 'user/login';
/controller/user/login.php class login extends CI_Controller { public function index() { $this->load->view('welcome_message'); } }
please help, gbu :)
It simply doesn't work in the way you want it to. Nobody can help you with that.