CodeIgniter Forums
CI_Loader extend causing headers error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI_Loader extend causing headers error (/showthread.php?tid=52592)



CI_Loader extend causing headers error - El Forum - 06-18-2012

[eluser]orzilca[/eluser]
Hello everybody,

I've came across something that drives me crazy. please help me Sad

I'm try to extend the CI_Loader Core in-order to create global header and footer.
For some reason, the extending causes error.

The extend code
Code:
class MY_Loader extends CI_Loader
    {

        function __construct()
        {
            // i need the codeigniter super-object
            // in all the function
        }

        public function load_header()
        {
            echo 'header';
        }
        
        public function load_footer()
        {
            echo 'footer';
        }
        
    }

The error i currently get
Code:
Unable to load the requested file: helpers/url_helper.php



CI_Loader extend causing headers error - El Forum - 06-18-2012

[eluser]orzilca[/eluser]
Ignore the topic, its not acurate.
Yesterday i had some headers error with the same code.. now its the current error

what am i doing wrong?


CI_Loader extend causing headers error - El Forum - 06-18-2012

[eluser]orzilca[/eluser]
Update
Changed the code and got the header error again

Code:
class MY_Loader extends CI_Loader
    {

        function __construct() {
            parent::__construct();
    
            $CI =& get_instance();
            $CI->load = $this;
        }

        public function load_header()
        {
            echo 'header';
        }
        
        public function load_footer()
        {
            echo 'footer';
        }
        
    }

Error
Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /mounted-storage/home75b/sub007/sc43190-SREL/gogetmilk.com/application/core/MY_Loader.php:1)

Filename: libraries/Session.php

Line Number: 672

I haven't changed anything in codeigniter's core
its a brand new version from yesterday, just created my_loader