CodeIgniter Forums
[SOLVED] View losing CSS Style after login validation fails. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [SOLVED] View losing CSS Style after login validation fails. (/thread-48197.html)



[SOLVED] View losing CSS Style after login validation fails. - El Forum - 01-07-2012

[eluser]cdonate[/eluser]
So, this is the header of my login_view.php.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html xml:lang="en" lang="en"&gt;
    &lt;head&gt;
        &lt;title&gt;Login SINUS 2012&lt;/title&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
        &lt;base href="&lt;?=base_url();?&gt;" /&gt;
        &lt;link rel="stylesheet" type="text/css" href="css/default2.css"/&gt;
    &lt;/head&gt;

My controller have this code in it:

Code:
&lt;?php

class Login extends CI_Controller{

function index(){
  $this->load->view('login_view');
}

function validate_credentials(){

  $this->load->model('membership_model');
  $query = $this->membership_model->validate();
  
  if($query){ //Se as credenciais forem validadas

   $data = array(
    'username' => $this->input->post('username'),
    'is_logged_in' => true
   );
   $this->session->set_userdata($data);
   $this->load->view('escolha_view');
  
  
  }else{
                       //$this->load->view('login_view');
         $this->index();
       }
}
When I point my browser to:
http://localhost/code/index.php/
the page is displayed without problem, the CSS Style and images are linked.

But, if I just click on Login, without typing my credentials the page loses all its styles and images.
After the failed authentication my browser points to:
http://localhost/code/index.php/login/validate_credentials

I gess that that has something to do with it.

My base_url is set to http://localhost/code/, that is pointing to C:\wamp\www\code.

My css and img files are inside C:\wamp\www\code\css and C:\wamp\www\code\img.

Thanks for the help, guys!


[SOLVED] View losing CSS Style after login validation fails. - El Forum - 11-17-2012

[eluser]Unknown[/eluser]
I made an account on here just to say THANK YOU! Big Grin Funny how the simplest of things can stump you for hours!