CodeIgniter Forums
single construct for all controllers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: single construct for all controllers (/showthread.php?tid=41705)



single construct for all controllers - El Forum - 05-14-2011

[eluser]jtan[/eluser]
Is it possible to have single construct across several controllers?


single construct for all controllers - El Forum - 05-14-2011

[eluser]skunkbad[/eluser]
[quote author="jtan" date="1305447714"]Is it possible to have single construct across several controllers?[/quote]

It is if you extend CI_Controller. Make a MY_Controller and put it in application/core.


single construct for all controllers - El Forum - 05-14-2011

[eluser]jtan[/eluser]
right now, I make My_Controller and extends CI_Controller then make the new controller extend from My_Controller

is my understanding correct that:

I make My_Controller and place it in application/core then just extend the new class from My_Controller the usual way?


single construct for all controllers - El Forum - 05-15-2011

[eluser]jtan[/eluser]
thanks, working now