I am developing a website using the MVC pattern with the CodeIgniter framework.
I have 2 controllers:
Site - Main Controller Navigates In Views
class Site extends CI_Controller {
public function index() {
$this->view ();
}
public function view($page = 'home') {
if (! file_exists ( "application/views/pages/$page.php" )) {
show_404 ();
}
$data ['page'] = 'pages/' . $page;
$this->load->view ( 'template/template.php', $data );
}
}
Members - Controller for managing membership system
class Members extends CI_Controller {
public function __construct() {
$this->load->model ( "members_model" );
}
public function login() {
$this->members_model->login ();
}
}
My Routes Config
$route ['default_controller'] = "site";
$route ['(:any)'] = "site/view/$1";
So now I have a little problem which is when I call the members controller, it'll look for a page named members and not a controller named members.
What can I do to fix that?