From 37f4b9caa02783e06dd7c5318200113409a0deb1 Mon Sep 17 00:00:00 2001
From: Derek Jones 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