From 2067d1a727e7eb5e5ffb40e967f3d1fc4c8a41b2 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 13 Nov 2008 22:59:24 +0000 Subject: Changing EOL style to LF --- user_guide/general/hooks.html | 332 +++++++++++++++++++++--------------------- 1 file changed, 166 insertions(+), 166 deletions(-) (limited to 'user_guide/general/hooks.html') diff --git a/user_guide/general/hooks.html b/user_guide/general/hooks.html index dcea24de1..ae2a3db0a 100644 --- a/user_guide/general/hooks.html +++ b/user_guide/general/hooks.html @@ -1,167 +1,167 @@ - - - - - -Hooks : CodeIgniter User Guide - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 1.7

-
- - - - - - - - - -
- - -
- - - -
- -

Hooks - Extending the Framework Core

- -

CodeIgniter's Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. -When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. -There may be instances, however, where you'd like to cause some action to take place at a particular stage in the execution process. -For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of -your own scripts in some other location. -

- -

Enabling Hooks

- -

The hooks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file:

- -$config['enable_hooks'] = TRUE; - - -

Defining a Hook

- -

Hooks are defined in 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')
-                                );
- -

Notes:
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:

- - - - -

Multiple Calls to the Same Hook

- -

If want to use the same hook point with more then one script, simply make your array declaration multi-dimensional, like this:

- - -$hook['pre_controller'][] = array(
-                                'class'    => 'MyClass',
-                                'function' => 'Myfunction',
-                                'filename' => 'Myclass.php',
-                                'filepath' => 'hooks',
-                                'params'   => array('beer', 'wine', 'snacks')
-                                );
-
-$hook['pre_controller'][] = array(
-                                'class'    => 'MyOtherClass',
-                                'function' => 'MyOtherfunction',
-                                'filename' => 'Myotherclass.php',
-                                'filepath' => 'hooks',
-                                'params'   => array('red', 'yellow', 'blue')
-                                );
- -

Notice the brackets after each array index:

- -$hook['pre_controller'][] - -

This permits you to have the same hook point with multiple scripts. The order you define your array will be the execution order.

- - -

Hook Points

- -

The following is a list of available hook points.

- - -
- - - - - - + + + + + +Hooks : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

CodeIgniter User Guide Version 1.7

+
+ + + + + + + + + +
+ + +
+ + + +
+ +

Hooks - Extending the Framework Core

+ +

CodeIgniter's Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. +When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. +There may be instances, however, where you'd like to cause some action to take place at a particular stage in the execution process. +For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of +your own scripts in some other location. +

+ +

Enabling Hooks

+ +

The hooks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file:

+ +$config['enable_hooks'] = TRUE; + + +

Defining a Hook

+ +

Hooks are defined in 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')
+                                );
+ +

Notes:
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:

+ + + + +

Multiple Calls to the Same Hook

+ +

If want to use the same hook point with more then one script, simply make your array declaration multi-dimensional, like this:

+ + +$hook['pre_controller'][] = array(
+                                'class'    => 'MyClass',
+                                'function' => 'Myfunction',
+                                'filename' => 'Myclass.php',
+                                'filepath' => 'hooks',
+                                'params'   => array('beer', 'wine', 'snacks')
+                                );
+
+$hook['pre_controller'][] = array(
+                                'class'    => 'MyOtherClass',
+                                'function' => 'MyOtherfunction',
+                                'filename' => 'Myotherclass.php',
+                                'filepath' => 'hooks',
+                                'params'   => array('red', 'yellow', 'blue')
+                                );
+ +

Notice the brackets after each array index:

+ +$hook['pre_controller'][] + +

This permits you to have the same hook point with multiple scripts. The order you define your array will be the execution order.

+ + +

Hook Points

+ +

The following is a list of available hook points.

+ + +
+ + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b