Welcome Guest, Not a member yet? Register   Sign In
Class ‘Controller’ not found
#1

[eluser]Unknown[/eluser]
class Email extends Controller {
function Email()
{
parent::Controller();
$this->load->library('email');
}

it obtain Fatal error: Class 'Controller' not found in D:\wamp\www\test_condeignitor\application\controllers\email.php on line 2

but we change it to CI_Controller no problem but am not able to call parent::Controller();


THANKS IN ADVANCE


...............................................Sreenath Vanmelil
#2

[eluser]SimonH[/eluser]
Hi,

your problem lies in the fact that typically a class constructor as to have the exact same name as the class.

Thus, if you are now extending the CI_Controller class it's constructor would not be parent::Constructor() but rather parent::CI_Constructor, however you should preferably use parent::__construct.

Hope this helps.
#3

[eluser]InsiteFX[/eluser]
And if your using CodeIgniter 2.0 its like this:
Code:
class Email extends CI_Controller {

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

    $this->load->library(‘email’);
}

And you also will need to change the controller it will conflict with the library name Email!

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB