CodeIgniter Forums
MY_Controller - I can't get it running - 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: MY_Controller - I can't get it running (/showthread.php?tid=46258)



MY_Controller - I can't get it running - El Forum - 10-25-2011

[eluser]breastfed[/eluser]
Hello

i am using the CI Version 2.0.2 and try to manage the following scenario:

I want to load two modells on every page / controller in CI.
So i set up the MY_Controller.php in application/core and put in there:

Code:
<?php
class MY_Controller extends CI_Controller {

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

function MY_Controller()
{
  parent::CI_Controller();
}
}

My Controllers like "home" and so on have "extends MY_Controller", but the output of doing this is:
Quote:Fatal error: Call to undefined method CI_Controller::CI_Controller() in /application/core/MY_Controller.php on line 10

line 10 is: parent::CI_Controller();

What am i doing wrong?

Many thanks!