Welcome Guest, Not a member yet? Register   Sign In
Extending CI_Controller
#1

[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!




Theme © iAndrew 2016 - Forum software by © MyBB