Welcome Guest, Not a member yet? Register   Sign In
__construct required?
#1

[eluser]brian88[/eluser]
Code:
class Main extends CI_Controller {
    function __construct() {
        parent::__construct();
    }
}

Is this required to do for every controller? Do you have to do it for models too?

I always see it in tutorials, but I've never used it before and everything still works fine. Does it automatically load if you don't type it?

The main use for it, I see, is just loading a model or library for this class, which I just autoload anyway.
#2

[eluser]InsiteFX[/eluser]
You do not need the Contructor unless you are setting up parameters are passing in parameters to the constructor
#3

[eluser]Matalina[/eluser]
Or if you are initializing something in the controller. Loading models for that controller etc.




Theme © iAndrew 2016 - Forum software by © MyBB