[eluser]duartix[/eluser]
You're very right. Loading the views shouldn't be done in the constructor. However,
$data is still not recognized in the view. :-(
Any ideas?
The view
application/views/logged.php wasn't changed.
The controller
application/controllers/home.php is now:
Code:
<?php
class Home extends CI_Controller {
public function __construct() {
parent::__construct();
// Initializes connection data
$data['connection'] = array(
'logged' => TRUE,
'username' => 'duarte',
);
}
public function index() {
if ($data['connection']['logged']) {
$this->load->view('templates/logged', $data);
} else {
$this->load->view('templates/login');
}
}
}