Welcome Guest, Not a member yet? Register   Sign In
Hook generates whitespace
#1

[eluser]dioony[/eluser]
Hi there!

I have a problem with my hook. If the hook is enabled, the hook creates a whitespace at the beginning of each page. Normally this is not a problem... But with RSS there is a problem, because XML (thus rss) expects the xml-expression at the first character...

Normally the output should generate "<?xml version=...".
If hooks are enabled it generates " <?xml version=...".

My Hook:
Code:
class TitleHook
{

    function doTitleHook()
    {
        $CI =& get_instance();
        $output = $CI->output->get_output();                    
        
        if(isset($CI->main_title)){
            $title = "WildeWetten - ".$CI->main_title;            
        }else{
            $title = "Normal Title";
        }
        $output = str_replace("{{MAIN_TITLE}}",$title, $output);
        
        $CI->output->_display($output);
        
    }
}

in hooks-config:

Code:
$hook['display_override'][] = array('class'    => 'TitleHook',
                                    'function' => 'doTitleHook',
                                    'filename' => 'TitleHook.php',
                                    'filepath' => 'hooks'
                                   );

i also tested something like
Code:
$output = substr($output,1)
, but it seems, that the whitespace will be added after the hook...

Does anybody know how to fix?




Theme © iAndrew 2016 - Forum software by © MyBB