I am getting the undefined variable whenever I load the controller.
Here is the index function from the controller that gets called ( 4th line ) and the same error in every other occurrence.
<?php
class Students extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('Student_model');
}
public function index() {
$data['view_name'] = 'students/dashboard';
$this->load->view('templates/template_student' , $data );
}
}
And the part of the template where the error comes from This is a part of the code from the template_student template
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<?php if ($student->passport_photo == '') { ?>
<img src="<?php echo base_url(); ?>assets/images/sample.jpg" alt="">
<?php } else { ?>
<img src="<?php echo base_url(); ?><?php echo $student->passport_photo; ?>" alt="">
<?php } ?>
<?php if ($this->session->userdata('logged_in')) : ?>
<?php echo $this->session->userdata('first_name') . " " . $this->session->userdata('last_name'); ?>
<?php endif; ?>
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu pull-right">
<li><a href="<?php echo base_url(); ?>students/profile"> Profile</a>
</li>
<li><a href="<?php echo base_url(); ?>students/logout"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
</li>
</ul>
</li>
</ul>
What have I done wrong?