[eluser]Kraig[/eluser]
Why is the variable test_var not working in the view like the guide shows? Variable is created at the end.
Controller:
Code:
class Members_area extends CI_Controller {
function index()
{
$is_logged_in = $this->loggedin->loggedin();
if(!$is_logged_in)
{
$data['main_content'] = 'home';
$this->load->view('includes/template2', $data);
}
else
{
$data['main_content'] = 'members_area';
$this->load->view('includes/template2', $data);
}
// Grabbing all the files associated with the current user
$this->load->model("upload_model");
$q = $this->upload_model->get_files();
$data['test_var'] = 'Test'; // Trying to use this variable in the views file
}
}
The View File:
Code:
<li><?php echo $test_var;?></li>
I get undefined variable as an error