1
In Codeigniter you can create a file in the application/core folder MY_Controller.php
and the controller extending this file, a basic example would be:
<?php
class MY_Controller extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper('url');
}
}
What I need is to create other files in this core extending the Ci_controller itself as for example a MY_Admincontroller.php
and he would have another model for My_controller, for example:
<?php
class MY_Admincontroller extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper('admin');
}
}
Only that doing so gives me a mistake that did not find the My_admincontroller.
Fatal error: Class 'My_admincontroller' not found in ...
I know it is possible to create this My_admincontroller right below My_controller, in the same file and so on, but with this the code will be much more polluted. Does anyone know if it’s possible to do what I want?
A way to do it, well summarized, but as I said, the code itself gets very polluted and with that difficult maintenance
<?php
class MY_Controller extends CI_Controller {}
class MY_Admincontroller extends MY_Controller {}
class MY_Othercontroller extends MY_Admincontroller {}
glue the error that is giving...
– MagicHat
In your project (root) you have two other subprojects that use/call the same framework but the second of the error? is this situation? if it is see if any of these reply help
– rray
@rray then, not that not, actually, in the same project I want to be able to create a My_controller that extends from Ci_controller, also to be able to create My_admincontroller that also extends from Ci_controller and then with this in my controllers folder I can have several controllers, some extending from My_controller and others from My_admincontroller
– Marcelo Diniz