Getting Controller name in post_controller_constructor hook |
[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.
[eluser]PERR0_HUNTER[/eluser]
I wonder if you ever got a solution to this problem
[eluser]WanWizard[/eluser]
You could use the output of debug_backtrace() to find what has called your method.
[eluser]Jelmer[/eluser]
You might try this: Code: $ci = get_instance(); The CI superobject is your controller (extending CI_Base and Controller).
[eluser]danmontgomery[/eluser]
Code: $CI =& get_instance();
[eluser]PERR0_HUNTER[/eluser]
Wonderful! One last question is there any way of also knowing what Method is being called ? right now I'm exploring the URI class to see if there's anyway I can get this info, also I came across this Filter System which I think does what the original author and I are intending to do http://codeigniter.com/wiki/Filters_system/
[eluser]danmontgomery[/eluser]
Code: $CI =& get_instance(); |
Welcome Guest, Not a member yet? Register Sign In |