I am working with Codeigniter PHP framework. I have the typicall Pages controller for displaying pages. I also added code for storing in the session variable in which page was the user before login. The thing is I'am getting as parameter 'favicon.ico' which make no sense because the page that was called was 'login' and displays well after that.
First as a temporary solution I checked the $page variable for the 'favicon.ico', and the weird thing was that after checking it I had inside the $page variable 'login'. It was very weird, I had to make a second check for login page as you see here for making it work. :
public function view($page = 'index')
{
if($page != 'favicon.ico'){
if($page != "login"){
$this->session->set_userdata('actual_page', $page);
}
}
if ( ! file_exists('application/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
$page="error";
}
// guardamos la página actual en la sesión
$data['title'] = ucfirst($page); // Capitalize the first letter
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
My question is, what is happening? Why if I only check for $page == 'login' it doesn't work. This is crazy.