custom helper function |
Hi all,
I have problem that, i am using custom helper function under controller class __construct() method. is it correct way to use that function is there ? PHP Code: public function __construct() and also custom_helper.php file is autoload. NOTE: is_user_login() function works with other methods but not work with construct method. I am curious about know reason behind that, or if it is possible then how? Thank in advance.
You should always call the parent constructor first.
PHP Code: public function __construct() Hope that helps. Also you really only need a constructor if you are setting variables and parameters. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(04-19-2018, 03:47 AM)InsiteFX Wrote: You should always call the parent constructor first. I loaded that file in autoload.php under helper.
(04-19-2018, 04:01 AM)dhaval Wrote: I loaded that file in autoload.php under helper. And autoload.php is executed by CI_Controller, the "parent" of your controller. That's why you must call parent::__construct(); first in the __construct() method of your controllers. (Essentially the same answer I gave for your Stackoverflow question.) |
Welcome Guest, Not a member yet? Register Sign In |