I am trying to extend the CodeIgniter controller. I have created MY_Controller.php
file, the content of the file is as following:
<?php
class MY_Controller extends CI_Controller
{
function generate_key()
{
$n = rand(10e16, 10e20);
return base_convert($n, 10, 36);
}
Now I create my controllers by extending MY_Controller
instead of CI_Controller
. Following is an example of a controller:
class Member extends MY_Controller
{
public function index()
{
$this->load->view('welcome');
}
I have placed the MY_Controller.php
file in the Application/libraries/
folder. But when I load the application, I get the error:
Fatal error: Class 'MY_Controller' not found in path\to\application\controllers\member.php
Can someone tell me what i am doing wrong? Thanks.
Edit: I'm using CodeIgniter 2.0.2