Hooks are defined in the
application/config/hooks.php
file. Each hook is specified as an array with this prototype
$hook['pre_controller'] = array(
'class' => 'MyClass',
'function' => 'Myfunction',
'filename' => 'Myclass.php',
'filepath' => 'hooks',
'params' => array('beer', 'wine', 'snacks')
);
The array index correlates to the name of the particular hook point you want to use. In the above example, the hook point is pre_controller
. A list of hook points is found below. The following items should be defined in your associative hook array:
class The name of the class you wish to invoke. If you prefer to use a procedural function instead of a class, leave this item blank.
function The function (or method) name you wish to call.
filename The file name containing your class/function.
file-path The name of the directory containing your script.
params Any parameters you wish to pass to your script. This item is optional.