You can also pass parameters stored in a config file. Simply create a config file named identically to the class file name
-and store it in your application/config/ folder. Note that if you dynamically pass parameters as described above,
+
You can also pass parameters stored in a config file. Simply create a config file named identically to the class file name
+and store it in your application/config/ folder. Note that if you dynamically pass parameters as described above,
the config file option will not be available.
@@ -202,7 +202,7 @@ etc.
Simply by naming your class files identically to a native library will cause CodeIgniter to use it instead of the native one. To use this
-feature you must name the file and the class declaration exactly the same as the native library. For example, to replace the native Email library
+feature you must name the file and the class declaration exactly the same as the native library. For example, to replace the native Email library
you'll create a file named application/libraries/Email.php, and declare your class with:
@@ -222,12 +222,12 @@ class CI_Email {
Extending Native Libraries
If all you need to do is add some functionality to an existing library - perhaps add a function or two - then
-it's overkill to replace the entire library with your version. In this case it's better to simply extend the class.
+it's overkill to replace the entire library with your version. In this case it's better to simply extend the class.
Extending a class is nearly identical to replacing a class with a couple exceptions:
- The class declaration must extend the parent class.
-- Your new class name and filename must be prefixed with MY_ (this item is configurable. See below.).
+- Your new class name and filename must be prefixed with MY_ (this item is configurable. See below.).
For example, to extend the native Email class you'll create a file named application/libraries/MY_Email.php, and declare your class with:
@@ -252,12 +252,12 @@ class MY_Email extends CI_Email {
Loading Your Sub-class
-To load your sub-class you'll use the standard syntax normally used. DO NOT include your prefix. For example,
+
To load your sub-class you'll use the standard syntax normally used. DO NOT include your prefix. For example,
to load the example above, which extends the Email class, you will use:
$this->load->library('email');
-Once loaded you will use the class variable as you normally would for the class you are extending. In the case of
+
Once loaded you will use the class variable as you normally would for the class you are extending. In the case of
the email class all calls will use:
diff --git a/user_guide/general/credits.html b/user_guide/general/credits.html
index 64b72c47d..9e0fbac04 100644
--- a/user_guide/general/credits.html
+++ b/user_guide/general/credits.html
@@ -58,7 +58,7 @@ Credits
Credits
CodeIgniter was originally developed by Rick Ellis (CEO of
-EllisLab, Inc.). The framework was written for performance in the real
+EllisLab, Inc.). The framework was written for performance in the real
world, with many of the class libraries, helpers, and sub-systems borrowed from the code-base of
ExpressionEngine.
diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html
index 4cdb56880..8dbeb93a8 100644
--- a/user_guide/general/drivers.html
+++ b/user_guide/general/drivers.html
@@ -58,15 +58,15 @@ Using CodeIgniter Drivers
Using CodeIgniter Drivers
-Drivers are a special type of Library that has a parent class and any number of potential child classes. Child classes have access to the parent class, but not their siblings. Drivers provide an elegant syntax in your controllers for libraries that benefit from or require being broken down into discrete classes.
+Drivers are a special type of Library that has a parent class and any number of potential child classes. Child classes have access to the parent class, but not their siblings. Drivers provide an elegant syntax in your controllers for libraries that benefit from or require being broken down into discrete classes.
-Drivers are found in the system/libraries folder, in their own folder which is identically named to the parent library class. Also inside that folder is a subfolder named drivers, which contains all of the possible child class files.
+Drivers are found in the system/libraries folder, in their own folder which is identically named to the parent library class. Also inside that folder is a subfolder named drivers, which contains all of the possible child class files.
To use a driver you will initialize it within a controller using the following initialization function:
$this->load->driver('class name');
-Where class name is the name of the driver class you want to invoke. For example, to load a driver named "Some Parent" you would do this:
+Where class name is the name of the driver class you want to invoke. For example, to load a driver named "Some Parent" you would do this:
$this->load->driver('some_parent');
diff --git a/user_guide/general/environments.html b/user_guide/general/environments.html
index 9aed1d6ff..175a1531e 100644
--- a/user_guide/general/environments.html
+++ b/user_guide/general/environments.html
@@ -58,17 +58,17 @@ Handling Multiple Environments
Handling Multiple Environments
- Developers often desire different system behavior depending on whether
- an application is running in a development or production
- environment. For example, verbose error output is something that would
- be useful while developing an application, but it may also pose a security issue when "live".
+ Developers often desire different system behavior depending on whether
+ an application is running in a development or production
+ environment. For example, verbose error output is something that would
+ be useful while developing an application, but it may also pose a security issue when "live".
The ENVIRONMENT Constant
- By default, CodeIgniter comes with the environment constant set to
- 'development'. At the top of index.php, you will see:
+ By default, CodeIgniter comes with the environment constant set to
+ 'development'. At the top of index.php, you will see:
@@ -76,35 +76,35 @@ define('ENVIRONMENT', 'development');
- In addition to affecting some basic framework behavior (see the next section),
- you may use this constant in your own development to differentiate
- between which environment you are running in.
+ In addition to affecting some basic framework behavior (see the next section),
+ you may use this constant in your own development to differentiate
+ between which environment you are running in.
Effects On Default Framework Behavior
- There are some places in the CodeIgniter system where the ENVIRONMENT
- constant is used. This section describes how default framework behavior is
- affected.
+ There are some places in the CodeIgniter system where the ENVIRONMENT
+ constant is used. This section describes how default framework behavior is
+ affected.
Error Reporting
- Setting the ENVIRONMENT constant to a value of 'development' will
- cause all PHP errors to be rendered to the browser when they occur. Conversely,
- setting the constant to 'production' will disable all error output. Disabling
- error reporting in production is a good security practice.
+ Setting the ENVIRONMENT constant to a value of 'development' will
+ cause all PHP errors to be rendered to the browser when they occur. Conversely,
+ setting the constant to 'production' will disable all error output. Disabling
+ error reporting in production is a good security practice.
Configuration Files
- Optionally, you can have CodeIgniter load environment-specific
- configuration files. This may be useful for managing things like differing API keys
- across multiple environments. This is described in more detail in the
- environment section of the Config Class documentation.
+ Optionally, you can have CodeIgniter load environment-specific
+ configuration files. This may be useful for managing things like differing API keys
+ across multiple environments. This is described in more detail in the
+ environment section of the Config Class documentation.
diff --git a/user_guide/general/errors.html b/user_guide/general/errors.html
index b1664c68d..58eff6597 100644
--- a/user_guide/general/errors.html
+++ b/user_guide/general/errors.html
@@ -60,13 +60,13 @@ Error Handling
CodeIgniter lets you build error reporting into your applications using the functions described below.
In addition, it has an error logging class that permits error and debugging messages to be saved as text files.
-Note: By default, CodeIgniter displays all PHP errors. You might
-wish to change this behavior once your development is complete. You'll find the error_reporting()
+
Note: By default, CodeIgniter displays all PHP errors. You might
+wish to change this behavior once your development is complete. You'll find the error_reporting()
function located at the top of your main index.php file. Disabling error reporting will NOT prevent log files
from being written if there are errors.
Unlike most systems in CodeIgniter, the error functions are simple procedural interfaces that are available
-globally throughout the application. This approach permits error messages to get triggered without having to worry
+globally throughout the application. This approach permits error messages to get triggered without having to worry
about class/function scoping.
The following functions let you generate errors:
@@ -88,9 +88,9 @@ Note that CodeIgniter automatically shows 404 messages if controllers are not fo
log_message('level', 'message')
-This function lets you write messages to your log files. You must supply one of three "levels"
+
This function lets you write messages to your log files. You must supply one of three "levels"
in the first parameter, indicating what type of message it is (debug, error, info), with the message
-itself in the second parameter. Example:
+itself in the second parameter. Example:
if ($some_var == "")
@@ -108,14 +108,14 @@ log_message('info', 'The purpose of some variable is to provide some value.');There are three message types:
-- Error Messages. These are actual errors, such as PHP errors or user errors.
-- Debug Messages. These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info.
-- Informational Messages. These are the lowest priority messages, simply giving information regarding some process. CodeIgniter doesn't natively generate any info messages but you may want to in your application.
+- Error Messages. These are actual errors, such as PHP errors or user errors.
+- Debug Messages. These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info.
+- Informational Messages. These are the lowest priority messages, simply giving information regarding some process. CodeIgniter doesn't natively generate any info messages but you may want to in your application.
Note: In order for the log file to actually be written, the
- "logs" folder must be writable. In addition, you must set the "threshold" for logging in application/config/config.php.
+ "logs" folder must be writable. In addition, you must set the "threshold" for logging in application/config/config.php.
You might, for example, only want error messages to be logged, and not the other two types.
If you set it to zero logging will be disabled.
diff --git a/user_guide/general/helpers.html b/user_guide/general/helpers.html
index 99f47178e..339a0df02 100644
--- a/user_guide/general/helpers.html
+++ b/user_guide/general/helpers.html
@@ -57,20 +57,20 @@ Helper Functions
Helper Functions
-Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular
-category. There are URL Helpers, that assist in creating links, there are Form Helpers
+
Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular
+category. There are URL Helpers, that assist in creating links, there are Form Helpers
that help you create form elements, Text Helpers perform various text formatting routines,
Cookie Helpers set and read cookies, File Helpers help you deal with files, etc.
-Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions.
+
Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions.
Each helper function performs one specific task, with no dependence on other functions.
CodeIgniter does not load Helper Files by default, so the first step in using
-a Helper is to load it. Once loaded, it becomes globally available in your controller and views.
+a Helper is to load it. Once loaded, it becomes globally available in your controller and views.
Helpers are typically stored in your system/helpers, or application/helpers directory. CodeIgniter will look first in your application/helpers
-directory. If the directory does not exist or the specified helper is not located there CI will instead look in your global
+directory. If the directory does not exist or the specified helper is not located there CI will instead look in your global
system/helpers folder.
@@ -87,10 +87,10 @@ directory. If the directory does not exist or the specified helper is not locate
$this->load->helper('url');
A helper can be loaded anywhere within your controller functions (or even within your View files, although that's not a good practice),
-as long as you load it before you use it. You can load your helpers in your controller constructor so that they become available
+as long as you load it before you use it. You can load your helpers in your controller constructor so that they become available
automatically in any function, or you can load a helper in a specific function that needs it.
-Note: The Helper loading function above does not return a value, so don't try to assign it to a variable. Just use it as shown.
+Note: The Helper loading function above does not return a value, so don't try to assign it to a variable. Just use it as shown.
Loading Multiple Helpers
@@ -117,12 +117,12 @@ This is done by opening the application/config/autoload.php file and
"Extending" Helpers
-To "extend" Helpers, create a file in your application/helpers/ folder with an identical name to the existing Helper, but prefixed with MY_ (this item is configurable. See below.).
+To "extend" Helpers, create a file in your application/helpers/ folder with an identical name to the existing Helper, but prefixed with MY_ (this item is configurable. See below.).
If all you need to do is add some functionality to an existing helper - perhaps add a function or two, or change how a particular
- helper function operates - then it's overkill to replace the entire helper with your version. In this case it's better to simply
- "extend" the Helper. The term "extend" is used loosely since Helper functions are procedural and discrete and cannot be extended
- in the traditional programmatic sense. Under the hood, this gives you the ability to add to the functions a Helper provides,
+ helper function operates - then it's overkill to replace the entire helper with your version. In this case it's better to simply
+ "extend" the Helper. The term "extend" is used loosely since Helper functions are procedural and discrete and cannot be extended
+ in the traditional programmatic sense. Under the hood, this gives you the ability to add to the functions a Helper provides,
or to modify how the native Helper functions operate.
For example, to extend the native Array Helper you'll create a file named application/helpers/MY_array_helper.php, and add or override functions:
@@ -154,7 +154,7 @@ function random_element($array)
Setting Your Own Prefix
-The filename prefix for "extending" Helpers is the same used to extend libraries and Core classes. To set your own prefix, open your application/config/config.php file and look for this item:
+The filename prefix for "extending" Helpers is the same used to extend libraries and Core classes. To set your own prefix, open your application/config/config.php file and look for this item:
$config['subclass_prefix'] = 'MY_';
@@ -163,7 +163,7 @@ function random_element($array)
Now What?
-In the Table of Contents you'll find a list of all the available Helper Files. Browse each one to see what they do.
+In the Table of Contents you'll find a list of all the available Helper Files. Browse each one to see what they do.
diff --git a/user_guide/general/hooks.html b/user_guide/general/hooks.html
index 1293d12eb..11de40902 100644
--- a/user_guide/general/hooks.html
+++ b/user_guide/general/hooks.html
@@ -73,7 +73,7 @@ your own scripts in some other location.
Defining a Hook
-Hooks are defined in application/config/hooks.php file. Each hook is specified as an array with this prototype:
+Hooks are defined in application/config/hooks.php file. Each hook is specified as an array with this prototype:
$hook['pre_controller'] = array(
@@ -85,14 +85,14 @@ $hook['pre_controller'] = array(
);
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.
+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 name you wish to call.
- filename The file name containing your class/function.
-- filepath The name of the directory containing your script. Note: Your script must be located in a directory INSIDE your application folder, so the file path is relative to that folder. For example, if your script is located in application/hooks, you will simply use hooks as your filepath. If your script is located in application/hooks/utilities you will use hooks/utilities as your filepath. No trailing slash.
+- filepath The name of the directory containing your script. Note: Your script must be located in a directory INSIDE your application folder, so the file path is relative to that folder. For example, if your script is located in application/hooks, you will simply use hooks as your filepath. If your script is located in application/hooks/utilities you will use hooks/utilities as your filepath. No trailing slash.
- params Any parameters you wish to pass to your script. This item is optional.
@@ -122,7 +122,7 @@ $hook['pre_controller'][] = array(
$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.
+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
@@ -131,7 +131,7 @@ $hook['pre_controller'][] = array(
- pre_system
- Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.
+ Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.
- pre_controller
Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.
- post_controller_constructor
@@ -139,10 +139,10 @@ $hook['pre_controller'][] = array(
- post_controller
Called immediately after your controller is fully executed.
- display_override
- Overrides the _display() function, used to send the finalized page to the web browser at the end of system execution. This permits you to
- use your own display methodology. Note that you will need to reference the CI superobject with $this->CI =& get_instance() and then the finalized data will be available by calling $this->CI->output->get_output()
+ Overrides the _display() function, used to send the finalized page to the web browser at the end of system execution. This permits you to
+ use your own display methodology. Note that you will need to reference the CI superobject with $this->CI =& get_instance() and then the finalized data will be available by calling $this->CI->output->get_output()
- cache_override
- Enables you to call your own function instead of the _display_cache() function in the output class. This permits you to use your own cache display mechanism.
+ Enables you to call your own function instead of the _display_cache() function in the output class. This permits you to use your own cache display mechanism.
- post_system
Called after the final rendered page is sent to the browser, at the end of system execution after the finalized data is sent to the browser.
diff --git a/user_guide/general/libraries.html b/user_guide/general/libraries.html
index ff869247f..ce367cdeb 100644
--- a/user_guide/general/libraries.html
+++ b/user_guide/general/libraries.html
@@ -63,7 +63,7 @@ In most cases, to use one of these classes involves initializing it within a $this->load->library('class name');
-Where class name is the name of the class you want to invoke. For example, to load the form validation class you would do this:
+Where class name is the name of the class you want to invoke. For example, to load the form validation class you would do this:
$this->load->library('form_validation');
diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html
index a6f9b72a0..ea886d9cb 100644
--- a/user_guide/general/managing_apps.html
+++ b/user_guide/general/managing_apps.html
@@ -58,7 +58,7 @@ Managing your Applications
Managing your Applications
By default it is assumed that you only intend to use CodeIgniter to manage one application, which you will build in your
-application/ directory. It is possible, however, to have multiple sets of applications that share a single
+application/ directory. It is possible, however, to have multiple sets of applications that share a single
CodeIgniter installation, or even to rename or relocate your application folder.
Renaming the Application Folder
@@ -83,7 +83,7 @@ To do so open your main index.php and set a full server path
put all of the directories located inside your application folder into their
own sub-folder.
-For example, let's say you want to create two applications, "foo" and "bar". You could structure your
+
For example, let's say you want to create two applications, "foo" and "bar". You could structure your
application folders like this:
applications/foo/
@@ -103,12 +103,12 @@ applications/bar/views/
To select a particular application for use requires that you open your main index.php file and set the $application_folder
-variable. For example, to select the "foo" application for use you would do this:
+variable. For example, to select the "foo" application for use you would do this:
$application_folder = "applications/foo";
Note: Each of your applications will need its own index.php file which
-calls the desired application. The index.php file can be named anything you want.
+calls the desired application. The index.php file can be named anything you want.
diff --git a/user_guide/general/models.html b/user_guide/general/models.html
index c0e494351..117c810b7 100644
--- a/user_guide/general/models.html
+++ b/user_guide/general/models.html
@@ -72,8 +72,8 @@ Models
What is a Model?
-Models are PHP classes that are designed to work with information in your database. For example, let's say
-you use CodeIgniter to manage a blog. You might have a model class that contains functions to insert, update, and
+
Models are PHP classes that are designed to work with information in your database. For example, let's say
+you use CodeIgniter to manage a blog. You might have a model class that contains functions to insert, update, and
retrieve your blog data. Here is an example of what such a model class might look like:
@@ -116,10 +116,10 @@ class Blogmodel extends CI_Model {
}
Note: The functions in the above example use the Active Record database functions.
-Note: For the sake of simplicity in this example we're using $_POST directly. This is generally bad practice, and a more common approach would be to use the Input Class $this->input->post('title')
+Note: For the sake of simplicity in this example we're using $_POST directly. This is generally bad practice, and a more common approach would be to use the Input Class $this->input->post('title')
Anatomy of a Model
-Model classes are stored in your application/models/ folder. They can be nested within sub-folders if you
+
Model classes are stored in your application/models/ folder. They can be nested within sub-folders if you
want this type of organization.
The basic prototype for a model class is this:
@@ -134,10 +134,10 @@ class Model_name extends CI_Model {
}
}
-The file name will be a lower case version of your class name. For example, if your class is this:
+The file name will be a lower case version of your class name. For example, if your class is this:
If you find that you need a particular model globally throughout your application, you can tell CodeIgniter to auto-load it during system initialization. This is done by opening the application/config/autoload.php file and adding the model to the autoload array.
+If you find that you need a particular model globally throughout your application, you can tell CodeIgniter to auto-load it during system initialization. This is done by opening the application/config/autoload.php file and adding the model to the autoload array.