CodeIgniter Forums
Extending CI_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: Extending CI_Controller (/showthread.php?tid=45484)



Extending CI_Controller - El Forum - 09-23-2011

[eluser]Unknown[/eluser]
Hy guys!

I am trying to extend CI_Controller class.

I have created a file, named "MY_Backend_Controller.php" and placed into "application/core/".
The file contains the following code:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Backend_Controller extends CI_Controller {

}

But when i try somethig like this:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MY_Backend_Controller {

public function index()
{
  $this->load->view('welcome_message');
}

}
It says "Fatal error: Class 'MY_Backend_Controller' not found ...".

If I replace the name of the class "MY_Backend_Controller" with "MY_Controller" it works! I don't get it why!