Welcome Guest, Not a member yet? Register   Sign In
Hooks - A foolish problem solved!
#1

[eluser]libnac[/eluser]
Hi,

If anyone has problems with a hooks be sure that the hook class or function is not finished by any blank space or anything else, because you will be in a trouble.

Code:
<?php

if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Lang
*/

function setlang() {
    
    $ci =& get_instance();
    
    $class = strtolower($ci->uri->router->class);
  
    
    if(!$ci->db_session->userdata('logged_in')) {
        
        $newdata = array(
                   'username'  => 'guest',
                   'email'     => '',
                   'logged_in' => TRUE,
                   'lang'        => 'spanish',
               );
        
        $ci->db_session->set_userdata($newdata);
    }
    
    $ci->lang->load($class , $ci->db_session->userdata('lang'));
}
?&gt; <-- !!!!!!!!DELETE ALL CHARS FROM HERE!!!!!!!!


I hope this will be useful.

Regards,
libnac
#2

[eluser]Glen Swinfield[/eluser]
Same applies to any other file - whitespace = content so redirect will not work because headers will already be sent, and a whole load of other issues.
#3

[eluser]Newton Wagner[/eluser]
In addition, the php end tag (?&gtWink is optional... so you can remove them and you will not have this problem again. Smile.




Theme © iAndrew 2016 - Forum software by © MyBB