CodeIgniter Forums
Extending CI_Controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Extending CI_Controller (/thread-45484.html)



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!