[eluser]Wondering Coder[/eluser]
hi codeigniter's families
first of all this is my first time to used codeigniter MVC and i'm in love with it. Also i'm not that good in PHP though. So please bear with me. Here goes.. I have my main template to load which has the basic header, content and footer(
see below). My problem is I don't know how to put my arguments.
template.php
Code:
<?
$this->load->view('includes/header');
if($classification == 'company')//undefine variable $classification
{
$this->load->view('includes/com_leftnav');
}
else
{
$this->load->view('includes/stud_leftnav');
}
if(isset($content)) echo $content;
$this->load->view('includes/footer');
?>
it gives me an undefined variable. I know what this means but could anyone help me to fix this? BTW, i'm doing this kind of argument coz i have two different left navigation for student and company.
Any response will be very helpful to me. I'll keep checking on my topic.
For futher info here's my controller
Code:
function validate_credentials()
{
$data['username'] = $this->input->post('username');
$data['password'] = md5($this->input->post('password'));
$data['classification'] = $this->input->post('classification');
$query = $this->membership_model->validate($data);
if($query) // if the user's credentials validated...
{
$data = array(
'username' => $this->input->post('username'),
'classification' => $this->input->post('classification'),//used in views
'is_logged_in' => true
);
$this->session->set_userdata($data);
if($data['classification'] == 'company')
{
$data = $this->input->post('classification');
redirect('com_site');
}
else
{
redirect('stud_site');
}
}
else // incorrect username or password
{
$this->index();
}
}