Welcome Guest, Not a member yet? Register   Sign In
My CSS is not loading properly after login validation.
#1

[eluser]versatek[/eluser]
The main page of my site is a login form and the CSS loads just fine. Once the user enters the wrong credentials, the login page loads again and it displays the errors. Problem: when the login form loads for the second time the CSS does not load. Here is my code:
Code:
public function login_validation()
{
  $this->load->library('form_validation');
  
  $this->form_validation->set_rules('email', 'Email', 'required|trim|xss_clean|callback_validate_credentials');
  $this->form_validation->set_rules('password', 'Password', 'required|md5');
  
  if($this->form_validation->run()){
   //setting the session right below...
   $data = array(
   'email'=>$this->input->post('email'),
   'is_logged_in'=>1
   );
   $this->session->set_userdata($data);
  
   redirect('main/members');
  }
  else{
   $this->load->view('login');  //unsuccessful login. Loads the view without CSS
  }

}
public function validate_credentials()
{
  $this->load->model('model_users');
  if($this->model_users->can_log_in()){
   return true;
  }
  else{
   $this->form_validation->set_message('validate_credentials','Incorrect username/password.
            Also, your account may not be active yet');
   return false;
  }
  
}

Please let me know. Thanks for your help.
#2

[eluser]versatek[/eluser]
I was not using proper syntax in the <head> tag.
Code:
<link rel="stylesheet" href='<?php echo base_url()."css/style.css" ?>' />

I am new to CodeIgniter, so is it possible to wrap up the header and display it when need it? Like inside a function?




Theme © iAndrew 2016 - Forum software by © MyBB