Welcome Guest, Not a member yet? Register   Sign In
Extanding the CI_Controller ot working
#1

[eluser]YahyaKACEM[/eluser]
hi, i'm using the Codeigniter.2.1.3 for a website, so i need to extend the CI_Controller so i can add a method to be executed with all controllers so i did what's in the user_guide:
creating a file named MY_Controller.php in the application/core folder the creating in it MY_Controller Class that extends the CI_Controller, the changing my regular controller to extend the MY_controller like this:
MY_controller.php:
Code:
class MY_Controller extends CI_Controller{
protected $page;
# Constructor
function __construct (){
  parent::__construct();
  #code shared with all controllers
}
public function get_page(){
            #code to get_the right page here
}
}
regular controller named Regular.php:
Code:
class Regular extends MY_Controller{
public function __construct(){
  parent::__construct();
}
public function index(){
  $this->get_page();
}
}
but the following error keep appearing:
Fatal error: Class 'MY_Controller' not found in /var/www/immo/CodeIgniter_2.1.3/application/controllers/regular.php on line 2
thanx in advance.


Messages In This Thread
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 03:33 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 04:40 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 09:43 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 09:58 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 10:26 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 11:13 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 11:27 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 11:53 PM
Extanding the CI_Controller ot working - by El Forum - 11-20-2012, 11:56 PM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 12:22 AM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 06:02 AM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 08:11 AM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 08:30 AM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 09:06 AM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 11:01 AM
Extanding the CI_Controller ot working - by El Forum - 11-21-2012, 11:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB