Hooks only 1 controller - 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: Hooks only 1 controller (/showthread.php?tid=49832) |
Hooks only 1 controller - El Forum - 03-05-2012 [eluser]josepichu[/eluser] Hi! Can i aply a hook in a unique controller ??? how?? edit: I have my index controller and the rest, but I only want to execute an auth function to the rest of controllers. T have made this: Code: $hook['pre_controller'] = array( but with this code control_auth.php is execute in all the application controllers. I have seen the user guide. thks! Hooks only 1 controller - El Forum - 03-05-2012 [eluser]Luis ACE[/eluser] hi josepichu, Yes you can apply a hook only for a unique controller. You need to update your hook code to check which controller is called. Code: $current_controller = $this->CI->router->fetch_class(); you might need to change hook point from pre_controller to post_controller_constructor. Hooks only 1 controller - El Forum - 03-05-2012 [eluser]josepichu[/eluser] thanks very much!! |