![]() |
Getting Controller name in post_controller_constructor hook - 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: Getting Controller name in post_controller_constructor hook (/showthread.php?tid=3699) |
Getting Controller name in post_controller_constructor hook - El Forum - 10-17-2007 [eluser]Majd Taby[/eluser] Hey, in hooks.php, is there a way to get the controller name? I have a hook that redirects to a login page, but i want to know the name of the controller it is redirecting from, such that when the user logs in successfully, he can be redirected there. Getting Controller name in post_controller_constructor hook - El Forum - 07-26-2010 [eluser]PERR0_HUNTER[/eluser] I wonder if you ever got a solution to this problem Getting Controller name in post_controller_constructor hook - El Forum - 07-26-2010 [eluser]WanWizard[/eluser] You could use the output of debug_backtrace() to find what has called your method. Getting Controller name in post_controller_constructor hook - El Forum - 07-26-2010 [eluser]Jelmer[/eluser] You might try this: Code: $ci = get_instance(); The CI superobject is your controller (extending CI_Base and Controller). Getting Controller name in post_controller_constructor hook - El Forum - 07-26-2010 [eluser]danmontgomery[/eluser] Code: $CI =& get_instance(); Getting Controller name in post_controller_constructor hook - El Forum - 07-26-2010 [eluser]PERR0_HUNTER[/eluser] Wonderful! One last question ![]() Getting Controller name in post_controller_constructor hook - El Forum - 07-26-2010 [eluser]danmontgomery[/eluser] Code: $CI =& get_instance(); |