CodeIgniter Forums
Launch automatically function - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Launch automatically function (/thread-20430.html)



Launch automatically function - El Forum - 07-09-2009

[eluser]Louis![/eluser]
Hello,

I have developed a library to verify if the user is autentified. I'm looking for a way to launch automatically the function which check that.

I think i should integrate the test in the master Controller but maybe exists a best way to dothat ?

Thanks

Louis


ps : sorry for my english Wink


Launch automatically function - El Forum - 07-09-2009

[eluser]Dam1an[/eluser]
Hi louis, welcome to CI
You can either extend the base controller, or you a hook

I personally prefer to use the MY_Controller approach Smile


Launch automatically function - El Forum - 07-09-2009

[eluser]TheFuzzy0ne[/eluser]
You could just auto load the library, and have it perform some tasks upon instantiation - like the session library.


Launch automatically function - El Forum - 07-15-2009

[eluser]Louis![/eluser]
Sorry for the delay.

I think the MY_Controller approach is the best solution because the library must permit to make the authentification when you want and not always on instantiation.

Thanks for yours answers

Louis