From e334c472fb4be44feec3a73402fc4a2b062cbfc0 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 21 Oct 2006 19:44:22 +0000 Subject: --- user_guide/general/controllers.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'user_guide/general/controllers.html') diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index f83cab89f..fd6a4bdf0 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -12,7 +12,7 @@ @@ -137,14 +137,14 @@ class blog extends Controller {
}
?> -

Also, always make sure your controller extends the parent controller class so that it can inherit all its functions.

+

Also, always make sure your controller extends the parent controller class so that it can inherit all its functions.

Functions

-

In the above example the function name is index(). The "index" function is always loaded by default if the +

In the above example the function name is index(). The "index" function is always loaded by default if the second segment of the URI is empty. Another way to show your "Hello World" message would be this:

www.your-site.com/index.php/blog/index/ @@ -208,8 +208,8 @@ passed to your function will be the re-routed ones.

Defining a Default Controller

-

Code Igniter can be told to load a default controller when a URI is not present, -as will be the case when only your site root URL is requested. To specify a default controller, open +

Code Igniter can be told to load a default controller when a URI is not present, +as will be the case when only your site root URL is requested. To specify a default controller, open your application/config/routes.php file and set this variable:

$route['default_controller'] = 'Blog'; @@ -230,8 +230,8 @@ Code Igniter permits you to override this behavior through the use of the _     // Some code here...
} -

Important:  If your controller contains a function named _remap(), it will always -get called regardless of what your URI contains. It overrides the normal behavior in which the URI determines which function is called, +

Important:  If your controller contains a function named _remap(), it will always +get called regardless of what your URI contains. It overrides the normal behavior in which the URI determines which function is called, allowing you to define your own function routing rules.

The overridden function call (typically the second segment of the URI) will be passed as a parameter the _remap() function:

@@ -256,11 +256,11 @@ allowing you to define your own function routing rules.

Processing Output

Code Igniter has an output class that takes care of sending your final rendered data to the web browser automatically. More information on this can be found in the -Views and Output class pages. In some cases, however, you might want to -post-process the finalized data in some way and send it to the browser yourself. Code Igniter permits you to +Views and Output class pages. In some cases, however, you might want to +post-process the finalized data in some way and send it to the browser yourself. Code Igniter permits you to add a function named _output() to your controller that will receive the finalized output data. -

Important:  If your controller contains a function named _output(), it will always +

Important:  If your controller contains a function named _output(), it will always be called by the output class instead of echoing the finalized data directly. The first parameter of the function will contain the finalized output.

Here is an example:

@@ -364,7 +364,7 @@ Constructors can't return a value, but they can do some default work.

Reserved Function Names

-

Since your controller classes will extend the main application controller you +

Since your controller classes will extend the main application controller you must be careful not to name your functions identically to the ones used by that class, otherwise your local functions will override them. The following is a list of reserved names. Do not name your controller functions any of these:

-- cgit v1.2.3-24-g4f1b