From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001
From: Razican Let's create a simple controller so you can see it in action. Using your text editor, create a file called blog.php, and put the following code in it: Let's create a simple controller so you can see it in action. Using your text editor, create a file called blog.php, and put the following code in it:Let's try it: Hello World!
-
CodeIgniter 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 +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';
@@ -226,7 +226,7 @@ CodeIgniter permits you to override this behavior through the use of the _r
}
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, +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 to the _remap() function:
@@ -259,9 +259,9 @@ allowing you to define your own function routing rules.CodeIgniter 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. CodeIgniter permits you to +
CodeIgniter 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. CodeIgniter 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
@@ -275,7 +275,7 @@ public function _output($output)
echo $output;
}
-
Please note that your _output() function will receive the data in its finalized state. Benchmark and memory usage data will be rendered, +
Please note that your _output() function will receive the data in its finalized state. Benchmark and memory usage data will be rendered,
cache files written (if you have caching enabled), and headers will be sent (if you use that feature)
before it is handed off to the _output() function.
@@ -287,14 +287,14 @@ To have your controller's output cached properly, its _output() metho
}
If you are using this feature the page execution timer and memory usage stats might not be perfectly accurate
-since they will not take into acccount any further processing you do. For an alternate way to control output before any of the final processing is done, please see
+since they will not take into acccount any further processing you do. For an alternate way to control output before any of the final processing is done, please see
the available methods in the Output Class.
In some cases you may want certain functions hidden from public access. To make a function private, simply add an +
In some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this:
@@ -312,11 +312,11 @@ private function _utility()
Organizing Your Controllers into Sub-folders
-If you are building a large application you might find it convenient to organize your controllers into sub-folders. CodeIgniter permits you to do this.
+If you are building a large application you might find it convenient to organize your controllers into sub-folders. CodeIgniter permits you to do this.
Simply create folders within your application/controllers directory and place your controller classes within them.
-Note: When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller
+
Note: When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller
located here:
application/controllers/products/shoes.php
@@ -326,7 +326,7 @@ located here:
example.com/index.php/products/shoes/show/123
Each of your sub-folders may contain a default controller which will be
-called if the URL contains only the sub-folder. Simply name your default controller as specified in your
+called if the URL contains only the sub-folder. Simply name your default controller as specified in your
application/config/routes.php file
--
cgit v1.2.3-24-g4f1b
From 4b9c62980599228f070b401c7673dce8085b0c61 Mon Sep 17 00:00:00 2001
From: Derek Jones
Date: Fri, 1 Jul 2011 17:40:48 -0500
Subject: backed out 648b42a75739, which was a NON-trivial whitespace commit.
It broke the Typography class's string replacements, for instance
---
user_guide/general/controllers.html | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
(limited to 'user_guide/general/controllers.html')
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html
index 01ef3d1ff..c90916472 100644
--- a/user_guide/general/controllers.html
+++ b/user_guide/general/controllers.html
@@ -91,7 +91,7 @@ Controllers
Let's try it: Hello World!
-Let's create a simple controller so you can see it in action. Using your text editor, create a file called blog.php, and put the following code in it:
+Let's create a simple controller so you can see it in action. Using your text editor, create a file called blog.php, and put the following code in it:
@@ -116,7 +116,7 @@ class Blog extends CI_Controller {
If you did it right, you should see Hello World!.
-Note: Class names must start with an uppercase letter. In other words, this is valid:
+Note: Class names must start with an uppercase letter. In other words, this is valid:
<?php
class Blog extends CI_Controller {
@@ -139,14 +139,14 @@ class blog extends CI_Controller {
Functions
-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:
+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:
example.com/index.php/blog/index/
The second segment of the URI determines which function in the controller gets called.
-Let's try it. Add a new function to your controller:
+Let's try it. Add a new function to your controller:
@@ -204,7 +204,7 @@ passed to your function will be the re-routed ones.
Defining a Default Controller
CodeIgniter 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
+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';
@@ -226,7 +226,7 @@ CodeIgniter permits you to override this behavior through the use of the _r
}
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,
+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 to the _remap() function:
@@ -259,9 +259,9 @@ allowing you to define your own function routing rules.
Processing Output
-CodeIgniter 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. CodeIgniter permits you to
+
CodeIgniter 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. CodeIgniter 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
@@ -275,7 +275,7 @@ public function _output($output)
echo $output;
}
-Please note that your _output() function will receive the data in its finalized state. Benchmark and memory usage data will be rendered, +
Please note that your _output() function will receive the data in its finalized state. Benchmark and memory usage data will be rendered,
cache files written (if you have caching enabled), and headers will be sent (if you use that feature)
before it is handed off to the _output() function.
@@ -287,14 +287,14 @@ To have your controller's output cached properly, its _output() metho
}
If you are using this feature the page execution timer and memory usage stats might not be perfectly accurate
-since they will not take into acccount any further processing you do. For an alternate way to control output before any of the final processing is done, please see
+since they will not take into acccount any further processing you do. For an alternate way to control output before any of the final processing is done, please see
the available methods in the Output Class.
In some cases you may want certain functions hidden from public access. To make a function private, simply add an +
In some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this:
@@ -312,11 +312,11 @@ private function _utility()
Organizing Your Controllers into Sub-folders
-If you are building a large application you might find it convenient to organize your controllers into sub-folders. CodeIgniter permits you to do this.
+If you are building a large application you might find it convenient to organize your controllers into sub-folders. CodeIgniter permits you to do this.
Simply create folders within your application/controllers directory and place your controller classes within them.
-Note: When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller
+
Note: When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller
located here:
application/controllers/products/shoes.php
@@ -326,7 +326,7 @@ located here:
example.com/index.php/products/shoes/show/123
Each of your sub-folders may contain a default controller which will be
-called if the URL contains only the sub-folder. Simply name your default controller as specified in your
+called if the URL contains only the sub-folder. Simply name your default controller as specified in your
application/config/routes.php file
--
cgit v1.2.3-24-g4f1b