It’s been a while since I don’t use CI and I’m with a starter doubt.
EDIT:
class MY_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
if(!$this->session->userdata('usuario')) {
$this->load->view('login');
}
}
}
class Home extends MY_Controller {
public function __construct() {
parent::__construct();
Template::set('title', 'Login');
Template::set('view', 'home');
}
public function index() {
$this->load->view('template');
}
}
What happens is that is the user session is invalid, it will load the login view but as in my Home controller contructor method is calling the view home, its loading both views on the same page.