CodeIgniter Forums
Hook generates whitespace - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Hook generates whitespace (/showthread.php?tid=8852)

Hook generates whitespace - El Forum - 06-03-2008

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:
class TitleHook

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

in hooks-config:

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

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

Does anybody know how to fix?