Welcome Guest, Not a member yet? Register   Sign In
Howto extend default controller
#4

(This post was last modified: 10-25-2018, 01:59 AM by neuron.)

In your Controllers that extends MY_Controller:
PHP Code:
   public function __construct() 
 
   {
 
       parent::__construct(); // put it in first line in your controller

        //other codes

 
   


If child class has constructer method it overrides parent constructer method that means parent constructer will not run.
If child class does not have constructer method than parent constructer method will run.
If child class has constructer and you also want parent constructer to run your should put parent::__construct();
in constructer method of child class
Reply


Messages In This Thread
Howto extend default controller - by wjonker - 10-23-2018, 07:12 AM
RE: Howto extend default controller - by jreklund - 10-23-2018, 11:19 AM
RE: Howto extend default controller - by wjonker - 10-25-2018, 12:51 AM
RE: Howto extend default controller - by neuron - 10-25-2018, 01:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB