CodeIgniter Forums
Problem using _output in MY_Controller - 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: Problem using _output in MY_Controller (/showthread.php?tid=49413)



Problem using _output in MY_Controller - El Forum - 02-18-2012

[eluser]Unknown[/eluser]
Hi

Have a little problem with my MY_Controller

The code:

Code:
class MY_Controller extends CI_Controller {

    public $title = 'My website';
    // The template will use this to include default.css by default
    public $styles = array('default');

    function __construct()
    {
            parent::__construct();
    }

    function _output($content)
    {
        // Load the base template with output content available as $content
        $data['content'] = &$content;
        $this->load->view('shared/layout', $data);
    }
}

My Welcome controller:

Code:
class Welcome extends MY_Controller {

public $title = "Home";

public function __construct()
    {
         parent::__construct();
    }

public function index()
{
  $this->load->view('welcome_message');
}
}
The problem is that nothing is loaded, only a white blank page. No errors.
I have followed this: http://stackoverflow.com/questions/3675135/codeigniter-best-way-to-structure-partial-views?answertab=votes#tab-top

Any suggestions on how I can solve this?