CodeIgniter Forums
Hooks won't work - 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 won't work (/showthread.php?tid=3696)



Hooks won't work - El Forum - 10-17-2007

[eluser]Unknown[/eluser]
Hello and I would like to start off by saying that I love the CI Framework.. I've done some searching in the forums... and I can't find the answer to what I'm looking for..

I am using the module separation style of CI and I am trying to use hooks but for some reason it won't work.

I followed the user guide to set it up.. I also tried some examples in the forums.

Here is what I've got..

config.php file:

$config['enable_hooks'] = true; // enable hooks

$config['subclass_prefix'] = 'MY_'; // this is what my classes are set to.. for module separation

hooks.php file:

$hook['pre_controller'] = array(
'class' => 'MY_test',
'function' => 'checkit',
'filename' => 'MY_test.php',
'filepath' => 'hooks',
'params' => array('bob','tom')
};

so my file MY_test.php is in the application/hooks/ directory. and all I am trying to do is echo a message for now.. I also tried to return the message.. to see if it would display something.. but it doesn't..

My page shows blank :long:

I checked my log file because that is set to 4 to get all messages.. and it just says..

DEBUG - 2007-10-16 15:48:59 --> Config Class Initiallized

that is it.. also I don't see any php errors or notices.. not sure why that is..

any help would be greatful..

John


Hooks won't work - El Forum - 10-17-2007

[eluser]SteamSHIFT[/eluser]
assuming this is a copy paste of the hook:
Quote:$hook[’pre_controller’] = array(
‘class’ => ‘MY_test’,
‘function’ => ‘checkit’,
‘filename’ => ‘MY_test.php’,
‘filepath’ => ‘hooks’,
‘params’ => array(’bob’,’tom’)
};

the problem looks to be a parse error - at the end of the hook block you have a curly brace } instead of a parenthesis )


Hooks won't work - El Forum - 10-17-2007

[eluser]Unknown[/eluser]
:bug:

man thanks !!!!!!!!!

you know how long I've been looking at the code... and didn't notice that.....

I feel so dumb.... sometimes it just takes another set of eyes...

thanks... so much..