Tag Archives: codeigniter load helper in constructor
Codeigniter controller constructor
Codeigniter Controller constructor : Are special functions which are called when a new object is created.
Syntax : Codeigniter controller constructor
load->helper('date'); // More code goes here... } public function index(){ // if you load date helper in contructor you need not load here // all the helper date functions will be available here. } }
Note parent::__construct(); is required to override the parent class’s constructor.
If you load date helper in contructor you need not load date helper again in any function date helper will be available in all functions inside this controller.