diff options
author | Derek Jones <derek.jones@ellislab.com> | 2011-07-02 00:40:48 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2011-07-02 00:40:48 +0200 |
commit | 4b9c62980599228f070b401c7673dce8085b0c61 (patch) | |
tree | 314bd87831a09913cbbfd1ffe1447b3c38b394c5 /user_guide/general | |
parent | 114ab0988e20ac6be39ad363ff897a1a3b85e565 (diff) |
backed out 648b42a75739, which was a NON-trivial whitespace commit. It broke the Typography class's string replacements, for instance
Diffstat (limited to 'user_guide/general')
23 files changed, 187 insertions, 187 deletions
diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html index 574ab35d7..abd5845ff 100644 --- a/user_guide/general/alternative_php.html +++ b/user_guide/general/alternative_php.html @@ -58,19 +58,19 @@ Alternate PHP Syntax <h1>Alternate PHP Syntax for View Files</h1> <p>If you do not utilize CodeIgniter's <a href="../libraries/parser.html">template engine</a>, you'll be using pure PHP -in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use -PHPs alternative syntax for control structures and short tag echo statements. If you are not familiar with this syntax, it allows you to eliminate the braces from your code, +in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use +PHPs alternative syntax for control structures and short tag echo statements. If you are not familiar with this syntax, it allows you to eliminate the braces from your code, and eliminate "echo" statements.</p> <h2>Automatic Short Tag Support</h2> <p><strong>Note:</strong> If you find that the syntax described in this page does not work on your server it might be that "short tags" are disabled in your PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly, -allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your +allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your <dfn>config/config.php</dfn> file.</p> <p class="important">Please note that if you do use this feature, if PHP errors are encountered -in your <strong>view files</strong>, the error message and line number will not be accurately shown. Instead, all errors +in your <strong>view files</strong>, the error message and line number will not be accurately shown. Instead, all errors will be shown as <kbd>eval()</kbd> errors.</p> @@ -89,7 +89,7 @@ will be shown as <kbd>eval()</kbd> errors.</p> <h2>Alternative Control Structures</h2> <p>Controls structures, like <var>if</var>, <var>for</var>, <var>foreach</var>, and <var>while</var> can be -written in a simplified format as well. Here is an example using foreach:</p> +written in a simplified format as well. Here is an example using foreach:</p> <code> <ul><br /> @@ -102,14 +102,14 @@ written in a simplified format as well. Here is an example using foreach:</p> <br /> </ul></code> -<p>Notice that there are no braces. Instead, the end brace is replaced with <var>endforeach</var>. +<p>Notice that there are no braces. Instead, the end brace is replaced with <var>endforeach</var>. Each of the control structures listed above has a similar closing syntax: <var>endif</var>, <var>endfor</var>, <var>endforeach</var>, and <var>endwhile</var></p> -<p>Also notice that instead of using a semicolon after each structure (except the last one), there is a colon. This is +<p>Also notice that instead of using a semicolon after each structure (except the last one), there is a colon. This is important!</p> -<p>Here is another example, using if/elseif/else. Notice the colons:</p> +<p>Here is another example, using if/elseif/else. Notice the colons:</p> <code><var><?php if ($username == 'sally'): ?></var><br /> diff --git a/user_guide/general/autoloader.html b/user_guide/general/autoloader.html index 405dda30f..fae0b5fd9 100644 --- a/user_guide/general/autoloader.html +++ b/user_guide/general/autoloader.html @@ -75,7 +75,7 @@ consider auto-loading them for convenience.</p> loaded to the <samp>autoload</samp> array. You'll find instructions in that file corresponding to each type of item.</p> -<p class="important"><strong>Note:</strong> Do not include the file extension (.php) when adding items to the autoload array.</p> +<p class="important"><strong>Note:</strong> Do not include the file extension (.php) when adding items to the autoload array.</p> diff --git a/user_guide/general/caching.html b/user_guide/general/caching.html index abfe6ded9..c77f9a15d 100644 --- a/user_guide/general/caching.html +++ b/user_guide/general/caching.html @@ -68,8 +68,8 @@ By caching your pages, since they are saved in their fully rendered state, you c <h2>How Does Caching Work?</h2> <p>Caching can be enabled on a per-page basis, and you can set the length of time that a page should remain cached before being refreshed. -When a page is loaded for the first time, the cache file will be written to your <dfn>application/cache</dfn> folder. On subsequent page loads the cache file will be retrieved -and sent to the requesting user's browser. If it has expired, it will be deleted and refreshed before being sent to the browser.</p> +When a page is loaded for the first time, the cache file will be written to your <dfn>application/cache</dfn> folder. On subsequent page loads the cache file will be retrieved +and sent to the requesting user's browser. If it has expired, it will be deleted and refreshed before being sent to the browser.</p> <p>Note: The Benchmark tag is not cached so you can still view your page load speed when caching is enabled.</p> @@ -90,8 +90,8 @@ most logical to you. Once the tag is in place, your pages will begin being cache <h2>Deleting Caches</h2> -<p>If you no longer wish to cache a file you can remove the caching tag and it will no longer be refreshed when it expires. Note: -Removing the tag will not delete the cache immediately. It will have to expire normally. If you need to remove it earlier you +<p>If you no longer wish to cache a file you can remove the caching tag and it will no longer be refreshed when it expires. Note: +Removing the tag will not delete the cache immediately. It will have to expire normally. If you need to remove it earlier you will need to manually delete it from your cache folder.</p> diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html index 3c7a5df9e..bfac32685 100644 --- a/user_guide/general/common_functions.html +++ b/user_guide/general/common_functions.html @@ -68,7 +68,7 @@ Auto-loading Resources $str = quoted_printable_encode($str);<br /> }</code> -<p>Returns boolean <kbd>TRUE</kbd> if the installed version of PHP is equal to or greater than the supplied version number. Returns <kbd>FALSE</kbd> if the installed version of PHP is lower than the supplied version number.</p> +<p>Returns boolean <kbd>TRUE</kbd> if the installed version of PHP is equal to or greater than the supplied version number. Returns <kbd>FALSE</kbd> if the installed version of PHP is lower than the supplied version number.</p> <h2>is_really_writable('<var>path/to/file</var>')</h2> @@ -92,10 +92,10 @@ else<br /> <h2>set_status_header(<var>code</var>, '<var>text</var>');</h2> -<p>Permits you to manually set a server status header. Example:</p> +<p>Permits you to manually set a server status header. Example:</p> <code>set_status_header(401);<br /> -// Sets the header as: Unauthorized</code> +// Sets the header as: Unauthorized</code> <p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">See here</a> for a full list of headers.</p> 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 <a name="hello"></a> <h2>Let's try it: Hello World!</h2> -<p>Let's create a simple controller so you can see it in action. Using your text editor, create a file called <dfn>blog.php</dfn>, and put the following code in it:</p> +<p>Let's create a simple controller so you can see it in action. Using your text editor, create a file called <dfn>blog.php</dfn>, and put the following code in it:</p> <textarea class="textarea" style="width:100%" cols="50" rows="10"> @@ -116,7 +116,7 @@ class Blog extends CI_Controller { <p>If you did it right, you should see <samp>Hello World!</samp>.</p> -<p>Note: Class names must start with an uppercase letter. In other words, this is valid:</p> +<p>Note: Class names must start with an uppercase letter. In other words, this is valid:</p> <code><?php<br /> class <var>Blog</var> extends CI_Controller {<br /> @@ -139,14 +139,14 @@ class <var>blog</var> extends CI_Controller {<br /> <a name="functions"></a> <h2>Functions</h2> -<p>In the above example the function name is <dfn>index()</dfn>. The "index" function is always loaded by default if the -<strong>second segment</strong> of the URI is empty. Another way to show your "Hello World" message would be this:</p> +<p>In the above example the function name is <dfn>index()</dfn>. The "index" function is always loaded by default if the +<strong>second segment</strong> of the URI is empty. Another way to show your "Hello World" message would be this:</p> <code>example.com/index.php/<var>blog</var>/<samp>index</samp>/</code> <p><strong>The second segment of the URI determines which function in the controller gets called.</strong></p> -<p>Let's try it. Add a new function to your controller:</p> +<p>Let's try it. Add a new function to your controller:</p> <textarea class="textarea" style="width:100%" cols="50" rows="15"> @@ -204,7 +204,7 @@ passed to your function will be the re-routed ones.</p> <h2>Defining a Default Controller</h2> <p>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 <dfn>application/config/routes.php</dfn> file and set this variable:</p> <code>$route['default_controller'] = '<var>Blog</var>';</code> @@ -226,7 +226,7 @@ CodeIgniter permits you to override this behavior through the use of the <kbd>_r }</code> <p class="important"><strong>Important:</strong> If your controller contains a function named <kbd>_remap()</kbd>, it will <strong>always</strong> -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.</p> <p>The overridden function call (typically the second segment of the URI) will be passed as a parameter to the <kbd>_remap()</kbd> function:</p> @@ -259,9 +259,9 @@ allowing you to define your own function routing rules.</p> <a name="output"></a> <h2>Processing Output</h2> -<p>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 -<a href="views.html">Views</a> and <a href="../libraries/output.html">Output class</a> 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 +<p>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 +<a href="views.html">Views</a> and <a href="../libraries/output.html">Output class</a> 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 <dfn>_output()</dfn> to your controller that will receive the finalized output data.</p> <p><strong>Important:</strong> If your controller contains a function named <kbd>_output()</kbd>, it will <strong>always</strong> @@ -275,7 +275,7 @@ public function _output($output)<br /> echo $output;<br /> }</code> -<p class="important">Please note that your <dfn>_output()</dfn> function will receive the data in its finalized state. Benchmark and memory usage data will be rendered, +<p class="important">Please note that your <dfn>_output()</dfn> 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 <a href="../libraries/output.html">feature</a>) before it is handed off to the _output() function.<br /> <br /> @@ -287,14 +287,14 @@ To have your controller's output cached properly, its <dfn>_output()</dfn> metho }</code> 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 <em>before</em> 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 <em>before</em> any of the final processing is done, please see the available methods in the <a href="../libraries/output.html">Output Class</a>.</p> <a name="private"></a> <h2>Private Functions</h2> -<p>In some cases you may want certain functions hidden from public access. To make a function private, simply add an +<p>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:</p> <code> @@ -312,11 +312,11 @@ private function _utility()<br /> <a name="subfolders"></a> <h2>Organizing Your Controllers into Sub-folders</h2> -<p>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.</p> +<p>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.</p> <p>Simply create folders within your <dfn>application/controllers</dfn> directory and place your controller classes within them.</p> -<p><strong>Note:</strong> When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller +<p><strong>Note:</strong> When using this feature the first segment of your URI must specify the folder. For example, lets say you have a controller located here:</p> <code>application/controllers/<kbd>products</kbd>/shoes.php</code> @@ -326,7 +326,7 @@ located here:</p> <code>example.com/index.php/products/shoes/show/123</code> <p>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 <dfn>application/config/routes.php</dfn> file</p> diff --git a/user_guide/general/core_classes.html b/user_guide/general/core_classes.html index e5521b453..51c2c7440 100644 --- a/user_guide/general/core_classes.html +++ b/user_guide/general/core_classes.html @@ -111,12 +111,12 @@ class CI_Input {<br /><br /> <h2>Extending Core Class</h2> <p>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:</p> <ul> <li>The class declaration must extend the parent class.</li> -<li>Your new class name and filename must be prefixed with <kbd>MY_</kbd> (this item is configurable. See below.).</li> +<li>Your new class name and filename must be prefixed with <kbd>MY_</kbd> (this item is configurable. See below.).</li> </ul> <p>For example, to extend the native <kbd>Input</kbd> class you'll create a file named <dfn>application/core/</dfn><kbd>MY_Input.php</kbd>, and declare your class with:</p> diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html index a44ec47b7..8198c18fe 100644 --- a/user_guide/general/creating_libraries.html +++ b/user_guide/general/creating_libraries.html @@ -58,7 +58,7 @@ Creating Libraries <h1>Creating Libraries</h1> <p>When we use the term "Libraries" we are normally referring to the classes that are located in the <kbd>libraries</kbd> -directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create +directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create your own libraries within your <dfn>application/libraries</dfn> directory in order to maintain separation between your local resources and the global framework resources.</p> @@ -75,7 +75,7 @@ to an existing library. Or you can even replace native libraries just by placing <p>The page below explains these three concepts in detail.</p> -<p class="important"><strong>Note:</strong> The Database classes can not be extended or replaced with your own classes. All other classes are able to be replaced/extended.</p> +<p class="important"><strong>Note:</strong> The Database classes can not be extended or replaced with your own classes. All other classes are able to be replaced/extended.</p> <h2>Storage</h2> @@ -88,16 +88,16 @@ they are initialized.</p> <ul> <li>File names must be capitalized. For example: <dfn>Myclass.php</dfn></li> -<li>Class declarations must be capitalized. For example: <kbd>class Myclass</kbd></li> +<li>Class declarations must be capitalized. For example: <kbd>class Myclass</kbd></li> <li>Class names and file names must match.</li> </ul> <h2>The Class File</h2> -<p>Classes should have this basic prototype (Note: We are using the name <kbd>Someclass</kbd> purely as an example):</p> +<p>Classes should have this basic prototype (Note: We are using the name <kbd>Someclass</kbd> purely as an example):</p> -<code><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); +<code><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <br /><br /> class Someclass {<br /> <br /> @@ -136,7 +136,7 @@ $this->load->library('Someclass', <kbd>$params</kbd>);</code> <p>If you use this feature you must set up your class constructor to expect data:</p> -<code><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');<br /> +<code><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');<br /> <br /> class Someclass {<br /> <br /> @@ -147,8 +147,8 @@ class Someclass {<br /> }<br /><br /> ?></code> -<p class="important">You can also pass parameters stored in a config file. Simply create a config file named identically to the class <kbd>file name</kbd> -and store it in your <dfn>application/config/</dfn> folder. Note that if you dynamically pass parameters as described above, +<p class="important">You can also pass parameters stored in a config file. Simply create a config file named identically to the class <kbd>file name</kbd> +and store it in your <dfn>application/config/</dfn> folder. Note that if you dynamically pass parameters as described above, the config file option will not be available.</p> @@ -202,7 +202,7 @@ etc. <h2>Replacing Native Libraries with Your Versions</h2> <p>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 <kbd>Email</kbd> library +feature you must name the file and the class declaration exactly the same as the native library. For example, to replace the native <kbd>Email</kbd> library you'll create a file named <dfn>application/libraries/Email.php</dfn>, and declare your class with:</p> <code> @@ -222,12 +222,12 @@ class CI_Email {<br /><br /> <h2>Extending Native Libraries</h2> <p>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:</p> <ul> <li>The class declaration must extend the parent class.</li> -<li>Your new class name and filename must be prefixed with <kbd>MY_</kbd> (this item is configurable. See below.).</li> +<li>Your new class name and filename must be prefixed with <kbd>MY_</kbd> (this item is configurable. See below.).</li> </ul> <p>For example, to extend the native <kbd>Email</kbd> class you'll create a file named <dfn>application/libraries/</dfn><kbd>MY_Email.php</kbd>, and declare your class with:</p> @@ -252,12 +252,12 @@ class MY_Email extends CI_Email {<br /> <h3>Loading Your Sub-class</h3> -<p>To load your sub-class you'll use the standard syntax normally used. DO NOT include your prefix. For example, +<p>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:</p> <code>$this->load->library('<kbd>email</kbd>');</code> -<p>Once loaded you will use the class variable as you normally would for the class you are extending. In the case of +<p>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:</p> 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 <h1>Credits</h1> <p>CodeIgniter was originally developed by <a href="http://www.ellislab.com/">Rick Ellis</a> (CEO of -<a href="http://ellislab.com/">EllisLab, Inc.</a>). The framework was written for performance in the real +<a href="http://ellislab.com/">EllisLab, Inc.</a>). 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 <a href="http://www.expressionengine.com/">ExpressionEngine</a>.</p> 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 <h1>Using CodeIgniter Drivers</h1> -<p>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 <a href="controllers.html">controllers</a> for libraries that benefit from or require being broken down into discrete classes.</p> +<p>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 <a href="controllers.html">controllers</a> for libraries that benefit from or require being broken down into discrete classes.</p> -<p>Drivers are found in the <dfn>system/libraries</dfn> folder, in their own folder which is identically named to the parent library class. Also inside that folder is a subfolder named <kbd>drivers</kbd>, which contains all of the possible child class files.</p> +<p>Drivers are found in the <dfn>system/libraries</dfn> folder, in their own folder which is identically named to the parent library class. Also inside that folder is a subfolder named <kbd>drivers</kbd>, which contains all of the possible child class files.</p> <p>To use a driver you will initialize it within a controller using the following initialization function:</p> <code>$this->load->driver('<var>class name</var>'); </code> -<p>Where <var>class name</var> is the name of the driver class you want to invoke. For example, to load a driver named "Some Parent" you would do this:</p> +<p>Where <var>class name</var> is the name of the driver class you want to invoke. For example, to load a driver named "Some Parent" you would do this:</p> <code>$this->load->driver('<var>some_parent</var>');</code> 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 <h1>Handling Multiple Environments</h1> <p> - 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". </p> <h2>The ENVIRONMENT Constant</h2> <p> - By default, CodeIgniter comes with the environment constant set to - '<kbd>development</kbd>'. At the top of index.php, you will see: + By default, CodeIgniter comes with the environment constant set to + '<kbd>development</kbd>'. At the top of index.php, you will see: </p> <code> @@ -76,35 +76,35 @@ define('<var>ENVIRONMENT</var>', '<var>development</var>'); </code> <p> - 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. </p> <h2>Effects On Default Framework Behavior</h2> <p> - There are some places in the CodeIgniter system where the <kbd>ENVIRONMENT</kbd> - constant is used. This section describes how default framework behavior is - affected. + There are some places in the CodeIgniter system where the <kbd>ENVIRONMENT</kbd> + constant is used. This section describes how default framework behavior is + affected. </p> <h3>Error Reporting</h3> <p> - Setting the <kbd>ENVIRONMENT</kbd> constant to a value of '<kbd>development</kbd>' will - cause all PHP errors to be rendered to the browser when they occur. Conversely, - setting the constant to '<kbd>production</kbd>' will disable all error output. Disabling - error reporting in production is a <a href="security.html">good security practice</a>. + Setting the <kbd>ENVIRONMENT</kbd> constant to a value of '<kbd>development</kbd>' will + cause all PHP errors to be rendered to the browser when they occur. Conversely, + setting the constant to '<kbd>production</kbd>' will disable all error output. Disabling + error reporting in production is a <a href="security.html">good security practice</a>. </p> <h3>Configuration Files</h3> <p> - 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 <a href="../libraries/config.html#environments">Config Class</a> 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 <a href="../libraries/config.html#environments">Config Class</a> documentation. </p> </div> 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 <p>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.</p> -<p class="important"><strong>Note:</strong> By default, CodeIgniter displays all PHP errors. You might -wish to change this behavior once your development is complete. You'll find the <dfn>error_reporting()</dfn> +<p class="important"><strong>Note:</strong> By default, CodeIgniter displays all PHP errors. You might +wish to change this behavior once your development is complete. You'll find the <dfn>error_reporting()</dfn> 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.</p> <p>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.</p> <p>The following functions let you generate errors:</p> @@ -88,9 +88,9 @@ Note that CodeIgniter automatically shows 404 messages if controllers are not fo <h2>log_message('<var>level</var>', '<samp>message</samp>')</h2> -<p>This function lets you write messages to your log files. You must supply one of three "levels" +<p>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:</p> +itself in the second parameter. Example:</p> <code> if ($some_var == "")<br /> @@ -108,14 +108,14 @@ log_message('info', 'The purpose of some variable is to provide some value.');<b <p>There are three message types:</p> <ol> -<li>Error Messages. These are actual errors, such as PHP errors or user errors.</li> -<li>Debug Messages. These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info.</li> -<li>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.</li> +<li>Error Messages. These are actual errors, such as PHP errors or user errors.</li> +<li>Debug Messages. These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info.</li> +<li>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.</li> </ol> <p class="important"><strong>Note:</strong> 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 <dfn>application/config/config.php</dfn>. + "logs" folder must be writable. In addition, you must set the "threshold" for logging in <dfn>application/config/config.php</dfn>. 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.</p> 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 <h1>Helper Functions</h1> -<p>Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular -category. There are <dfn>URL Helpers</dfn>, that assist in creating links, there are <dfn>Form Helpers</dfn> +<p>Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular +category. There are <dfn>URL Helpers</dfn>, that assist in creating links, there are <dfn>Form Helpers</dfn> that help you create form elements, <dfn>Text Helpers</dfn> perform various text formatting routines, <dfn>Cookie Helpers</dfn> set and read cookies, <dfn>File Helpers</dfn> help you deal with files, etc. </p> -<p>Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions. +<p>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.</p> <p>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 <a href="../general/controllers.html">controller</a> and <a href="../general/views.html">views</a>.</p> +a Helper is to load it. Once loaded, it becomes globally available in your <a href="../general/controllers.html">controller</a> and <a href="../general/views.html">views</a>.</p> <p>Helpers are typically stored in your <dfn>system/helpers</dfn>, or <dfn>application/helpers </dfn>directory. CodeIgniter will look first in your <dfn>application/helpers</dfn> -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 <dfn>system/helpers</dfn> folder.</p> @@ -87,10 +87,10 @@ directory. If the directory does not exist or the specified helper is not locate <code>$this->load->helper('<var>url</var>');</code> <p>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.</p> -<p class="important">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.</p> +<p class="important">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.</p> <h2>Loading Multiple Helpers</h2> @@ -117,12 +117,12 @@ This is done by opening the <var>application/config/autoload.php</var> file and <h2>"Extending" Helpers</h2> -<p>To "extend" Helpers, create a file in your <dfn>application/helpers/</dfn> folder with an identical name to the existing Helper, but prefixed with <kbd>MY_</kbd> (this item is configurable. See below.).</p> +<p>To "extend" Helpers, create a file in your <dfn>application/helpers/</dfn> folder with an identical name to the existing Helper, but prefixed with <kbd>MY_</kbd> (this item is configurable. See below.).</p> <p>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.</p> <p>For example, to extend the native <kbd>Array Helper</kbd> you'll create a file named <dfn>application/helpers/</dfn><kbd>MY_array_helper.php</kbd>, and add or override functions:</p> @@ -154,7 +154,7 @@ function random_element($array)<br /> <h3>Setting Your Own Prefix</h3> -<p>The filename prefix for "extending" Helpers is the same used to extend libraries and Core classes. To set your own prefix, open your <dfn>application/config/config.php</dfn> file and look for this item:</p> +<p>The filename prefix for "extending" Helpers is the same used to extend libraries and Core classes. To set your own prefix, open your <dfn>application/config/config.php</dfn> file and look for this item:</p> <code>$config['subclass_prefix'] = 'MY_';</code> @@ -163,7 +163,7 @@ function random_element($array)<br /> <h2>Now What?</h2> -<p>In the Table of Contents you'll find a list of all the available Helper Files. Browse each one to see what they do.</p> +<p>In the Table of Contents you'll find a list of all the available Helper Files. Browse each one to see what they do.</p> </div> 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. <h2>Defining a Hook</h2> -<p>Hooks are defined in <dfn>application/config/hooks.php</dfn> file. Each hook is specified as an array with this prototype:</p> +<p>Hooks are defined in <dfn>application/config/hooks.php</dfn> file. Each hook is specified as an array with this prototype:</p> <code> $hook['pre_controller'] = array(<br /> @@ -85,14 +85,14 @@ $hook['pre_controller'] = array(<br /> );</code> <p><strong>Notes:</strong><br />The array index correlates to the name of the particular hook point you want to -use. In the above example the hook point is <kbd>pre_controller</kbd>. A list of hook points is found below. +use. In the above example the hook point is <kbd>pre_controller</kbd>. A list of hook points is found below. The following items should be defined in your associative hook array:</p> <ul> <li><strong>class</strong> 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.</li> <li><strong>function</strong> The function name you wish to call.</li> <li><strong>filename</strong> The file name containing your class/function.</li> -<li><strong>filepath</strong> The name of the directory containing your script. Note: Your script must be located in a directory INSIDE your <kbd>application</kbd> folder, so the file path is relative to that folder. For example, if your script is located in <dfn>application/hooks</dfn>, you will simply use <samp>hooks</samp> as your filepath. If your script is located in <dfn>application/hooks/utilities</dfn> you will use <samp>hooks/utilities</samp> as your filepath. No trailing slash.</li> +<li><strong>filepath</strong> The name of the directory containing your script. Note: Your script must be located in a directory INSIDE your <kbd>application</kbd> folder, so the file path is relative to that folder. For example, if your script is located in <dfn>application/hooks</dfn>, you will simply use <samp>hooks</samp> as your filepath. If your script is located in <dfn>application/hooks/utilities</dfn> you will use <samp>hooks/utilities</samp> as your filepath. No trailing slash.</li> <li><strong>params</strong> Any parameters you wish to pass to your script. This item is optional.</li> </ul> @@ -122,7 +122,7 @@ $hook['pre_controller']<kbd>[]</kbd> = array(<br /> <code>$hook['pre_controller']<kbd>[]</kbd></code> -<p>This permits you to have the same hook point with multiple scripts. The order you define your array will be the execution order.</p> +<p>This permits you to have the same hook point with multiple scripts. The order you define your array will be the execution order.</p> <h2>Hook Points</h2> @@ -131,7 +131,7 @@ $hook['pre_controller']<kbd>[]</kbd> = array(<br /> <ul> <li><strong>pre_system</strong><br /> - 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.</li> + 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.</li> <li><strong>pre_controller</strong><br /> Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.</li> <li><strong>post_controller_constructor</strong><br /> @@ -139,10 +139,10 @@ $hook['pre_controller']<kbd>[]</kbd> = array(<br /> <li><strong>post_controller</strong><br /> Called immediately after your controller is fully executed.</li> <li><strong>display_override</strong><br /> - Overrides the <dfn>_display()</dfn> 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 <dfn>$this->CI =& get_instance()</dfn> and then the finalized data will be available by calling <dfn>$this->CI->output->get_output()</dfn></li> + Overrides the <dfn>_display()</dfn> 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 <dfn>$this->CI =& get_instance()</dfn> and then the finalized data will be available by calling <dfn>$this->CI->output->get_output()</dfn></li> <li><strong>cache_override</strong><br /> - Enables you to call your own function instead of the <dfn>_display_cache()</dfn> function in the output class. This permits you to use your own cache display mechanism.</li> + Enables you to call your own function instead of the <dfn>_display_cache()</dfn> function in the output class. This permits you to use your own cache display mechanism.</li> <li><strong>post_system</strong><br /> 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.</li> </ul> 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 <a <code>$this->load->library('<var>class name</var>'); </code> -<p>Where <var>class name</var> is the name of the class you want to invoke. For example, to load the form validation class you would do this:</p> +<p>Where <var>class name</var> is the name of the class you want to invoke. For example, to load the form validation class you would do this:</p> <code>$this->load->library('<var>form_validation</var>'); </code> 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 <h1>Managing your Applications</h1> <p>By default it is assumed that you only intend to use CodeIgniter to manage one application, which you will build in your -<dfn>application/</dfn> directory. It is possible, however, to have multiple sets of applications that share a single +<dfn>application/</dfn> directory. It is possible, however, to have multiple sets of applications that share a single CodeIgniter installation, or even to rename or relocate your <dfn>application</dfn> folder.</p> <h2>Renaming the Application Folder</h2> @@ -83,7 +83,7 @@ To do so open your main <kbd>index.php</kbd> and set a <em>full server path</em> put all of the directories located inside your <kbd>application</kbd> folder into their own sub-folder.</p> -<p>For example, let's say you want to create two applications, "foo" and "bar". You could structure your +<p>For example, let's say you want to create two applications, "foo" and "bar". You could structure your application folders like this:</p> <code>applications/<var>foo</var>/<br /> @@ -103,12 +103,12 @@ applications/<samp>bar</samp>/views/</code> <p>To select a particular application for use requires that you open your main <kbd>index.php</kbd> file and set the <dfn>$application_folder</dfn> -variable. For example, to select the "foo" application for use you would do this:</p> +variable. For example, to select the "foo" application for use you would do this:</p> <code>$application_folder = "applications/foo";</code> <p class="important"><strong>Note:</strong> Each of your applications will need its own <dfn>index.php</dfn> file which -calls the desired application. The index.php file can be named anything you want.</p> +calls the desired application. The index.php file can be named anything you want.</p> 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 <h2><a name="what"></a>What is a Model?</h2> -<p>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 +<p>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:</p> <code> @@ -116,10 +116,10 @@ class Blogmodel extends CI_Model {<br /> }</code> <p>Note: The functions in the above example use the <a href="../database/active_record.html">Active Record</a> database functions.</p> -<p class="important"><strong>Note:</strong> 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 <a href="../libraries/input.html">Input Class</a> $this->input->post('title')</p> +<p class="important"><strong>Note:</strong> 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 <a href="../libraries/input.html">Input Class</a> $this->input->post('title')</p> <h2><a name="anatomy"></a>Anatomy of a Model</h2> -<p>Model classes are stored in your <dfn>application/models/</dfn> folder. They can be nested within sub-folders if you +<p>Model classes are stored in your <dfn>application/models/</dfn> folder. They can be nested within sub-folders if you want this type of organization.</p> <p>The basic prototype for a model class is this:</p> @@ -134,10 +134,10 @@ class <var>Model_name</var> extends CI_Model {<br /> }<br /> }</code> -<p>Where <var>Model_name</var> is the name of your class. Class names <strong>must</strong> have the first letter capitalized with the rest of the name lowercase. +<p>Where <var>Model_name</var> is the name of your class. Class names <strong>must</strong> have the first letter capitalized with the rest of the name lowercase. Make sure your class extends the base Model class.</p> -<p>The file name will be a lower case version of your class name. For example, if your class is this:</p> +<p>The file name will be a lower case version of your class name. For example, if your class is this:</p> <code> class <var>User_model</var> extends CI_Model {<br /> @@ -161,7 +161,7 @@ To load a model you will use the following function:</p> <code>$this->load->model('<var>Model_name</var>');</code> -<p>If your model is located in a sub-folder, include the relative path from your models folder. For example, if +<p>If your model is located in a sub-folder, include the relative path from your models folder. For example, if you have a model located at <dfn>application/models/blog/queries.php</dfn> you'll load it using:</p> <code>$this->load->model('<var>blog/queries</var>');</code> @@ -200,12 +200,12 @@ class Blog_controller extends CI_Controller {<br /> }</code> <h2><a name="auto_load_model" id="auto_load_model"></a>Auto-loading Models</h2> -<p>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.</p> +<p>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.</p> <h2><a name="conn"></a>Connecting to your Database</h2> -<p>When a model is loaded it does <strong>NOT</strong> connect automatically to your database. The following options for connecting are available to you:</p> +<p>When a model is loaded it does <strong>NOT</strong> connect automatically to your database. The following options for connecting are available to you:</p> <ul> <li>You can connect using the standard database methods <a href="../database/connecting.html">described here</a>, either from within your Controller class or your Model class.</li> diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html index fdf8b6c2b..78ece7dcd 100644 --- a/user_guide/general/profiling.html +++ b/user_guide/general/profiling.html @@ -87,7 +87,7 @@ This information can be useful during development in order to help with debuggin <h2>Enabling and Disabling Profiler Sections</h2> - <p>Each section of Profiler data can be enabled or disabled by setting a corresponding config variable to <var>TRUE</var> or <var>FALSE</var>. This can be done one of two ways. First, you can set application wide defaults with the <dfn>application/config/profiler.php</dfn> config file.</p> + <p>Each section of Profiler data can be enabled or disabled by setting a corresponding config variable to <var>TRUE</var> or <var>FALSE</var>. This can be done one of two ways. First, you can set application wide defaults with the <dfn>application/config/profiler.php</dfn> config file.</p> <code>$config['config'] = FALSE;<br /> $config['queries'] = FALSE;<br /></code> diff --git a/user_guide/general/reserved_names.html b/user_guide/general/reserved_names.html index 48b6b2a5e..00bebff61 100644 --- a/user_guide/general/reserved_names.html +++ b/user_guide/general/reserved_names.html @@ -61,8 +61,8 @@ Controllers <h3>Controller names</h3> <p>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 any of these:</p> +will override them. The following +is a list of reserved names. Do not name your controller any of these:</p> <ul> <li>Controller</li> <li>CI_Base</li> diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html index 6f06ad64f..d1d8d1a8e 100644 --- a/user_guide/general/routing.html +++ b/user_guide/general/routing.html @@ -80,7 +80,7 @@ To overcome this, CodeIgniter allows you to remap the URI handler.</p> <h2>Setting your own routing rules</h2> -<p>Routing rules are defined in your <var>application/config/routes.php</var> file. In it you'll see an array called <dfn>$route</dfn> that +<p>Routing rules are defined in your <var>application/config/routes.php</var> file. In it you'll see an array called <dfn>$route</dfn> that permits you to specify your own routing criteria. Routes can either be specified using <dfn>wildcards</dfn> or <dfn>Regular Expressions</dfn></p> @@ -90,7 +90,7 @@ permits you to specify your own routing criteria. Routes can either be specified <code>$route['product/:num'] = "catalog/product_lookup";</code> -<p>In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to. +<p>In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to. In the above example, if the literal word "product" is found in the first segment of the URL, and a number is found in the second segment, the "catalog" class and the "product_lookup" method are instead used.</p> @@ -111,10 +111,10 @@ Higher routes will always take precedence over lower ones.</p> <p>A URL containing the word "journals" in the first segment will be remapped to the "blogs" class.</p> <code>$route['blog/joe'] = "blogs/users/34";</code> -<p>A URL containing the segments blog/joe will be remapped to the "blogs" class and the "users" method. The ID will be set to "34".</p> +<p>A URL containing the segments blog/joe will be remapped to the "blogs" class and the "users" method. The ID will be set to "34".</p> <code>$route['product/(:any)'] = "catalog/product_lookup";</code> -<p>A URL with "product" as the first segment, and anything in the second will be remapped to the "catalog" class and the "product_lookup" method.</p> +<p>A URL with "product" as the first segment, and anything in the second will be remapped to the "catalog" class and the "product_lookup" method.</p> <code>$route['product/(:num)'] = "catalog/product_lookup_by_id/$1";</code> <p>A URL with "product" as the first segment, and a number in the second will be remapped to the "catalog" class and the "product_lookup_by_id" method passing in the match as a variable to the function.</p> @@ -123,7 +123,7 @@ Higher routes will always take precedence over lower ones.</p> <h2>Regular Expressions</h2> -<p>If you prefer you can use regular expressions to define your routing rules. Any valid regular expression is allowed, as are back-references.</p> +<p>If you prefer you can use regular expressions to define your routing rules. Any valid regular expression is allowed, as are back-references.</p> <p class="important"><strong>Note:</strong> If you use back-references you must use the dollar syntax rather than the double backslash syntax.</p> @@ -142,7 +142,7 @@ Higher routes will always take precedence over lower ones.</p> <code>$route['default_controller'] = 'welcome';</code> <p>This route indicates which controller class should be loaded if the URI contains no data, which will be the case -when people load your root URL. In the above example, the "welcome" class would be loaded. You +when people load your root URL. In the above example, the "welcome" class would be loaded. You are encouraged to always have a default route otherwise a 404 page will appear by default.</p> <code>$route['404_override'] = '';</code> diff --git a/user_guide/general/security.html b/user_guide/general/security.html index bcbb36c6f..ab92a94ba 100644 --- a/user_guide/general/security.html +++ b/user_guide/general/security.html @@ -64,7 +64,7 @@ CodeIgniter's internal security features.</p> <h2>URI Security</h2> <p>CodeIgniter is fairly restrictive regarding which characters it allows in your URI strings in order to help -minimize the possibility that malicious data can be passed to your application. URIs may only contain the following: +minimize the possibility that malicious data can be passed to your application. URIs may only contain the following: </p> <ul> @@ -79,7 +79,7 @@ minimize the possibility that malicious data can be passed to your application. <h2>GET, POST, and COOKIE Data</h2> <p>GET data is simply disallowed by CodeIgniter since the system utilizes URI segments rather than traditional URL query strings (unless -you have the query string option enabled in your config file). The global GET +you have the query string option enabled in your config file). The global GET array is <strong>unset</strong> by the Input class during system initialization.</p> <h2>Register_globals</h2> @@ -91,18 +91,18 @@ routine is effectively the same as register_globals = off.</p> <h2>error_reporting</h2> <p> - In production environments, it is typically desirable to disable PHP's - error reporting by setting the internal error_reporting flag to a value of 0. This disables native PHP - errors from being rendered as output, which may potentially contain - sensitive information. + In production environments, it is typically desirable to disable PHP's + error reporting by setting the internal error_reporting flag to a value of 0. This disables native PHP + errors from being rendered as output, which may potentially contain + sensitive information. </p> <p> - Setting CodeIgniter's <kbd>ENVIRONMENT</kbd> constant in index.php to a - value of '<kbd>production</kbd>' will turn off these errors. In development - mode, it is recommended that a value of '<kbd>development</kbd>' is used. - More information about differentiating between environments can be found - on the <a href="environments.html">Handling Environments</a> page. + Setting CodeIgniter's <kbd>ENVIRONMENT</kbd> constant in index.php to a + value of '<kbd>production</kbd>' will turn off these errors. In development + mode, it is recommended that a value of '<kbd>development</kbd>' is used. + More information about differentiating between environments can be found + on the <a href="environments.html">Handling Environments</a> page. </p> <h2>magic_quotes_runtime</h2> @@ -117,7 +117,7 @@ XML-RPC data, or even data from the SERVER array, you are encouraged to practice <ol> <li>Filter the data as if it were tainted.</li> -<li>Validate the data to ensure it conforms to the correct type, length, size, etc. (sometimes this step can replace step one)</li> +<li>Validate the data to ensure it conforms to the correct type, length, size, etc. (sometimes this step can replace step one)</li> <li>Escape the data before submitting it into your database.</li> </ol> @@ -127,7 +127,7 @@ XML-RPC data, or even data from the SERVER array, you are encouraged to practice <li><h2>XSS Filtering</h2> -<p>CodeIgniter comes with a Cross Site Scripting filter. This filter looks for commonly +<p>CodeIgniter comes with a Cross Site Scripting filter. This filter looks for commonly used techniques to embed malicious Javascript into your data, or other types of code that attempt to hijack cookies or do other malicious things. The XSS Filter is described <a href="../libraries/security.html">here</a>. </p> diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html index fc9ceb2e7..1f7a8a048 100644 --- a/user_guide/general/styleguide.html +++ b/user_guide/general/styleguide.html @@ -102,13 +102,13 @@ Style Guide <h2><a name="file_format"></a>File Format</h2> <div class="guidelineDetails"> - <p>Files should be saved with Unicode (UTF-8) encoding. The <abbr title="Byte Order Mark">BOM</abbr> - should <em>not</em> be used. Unlike UTF-16 and UTF-32, there's no byte order to indicate in + <p>Files should be saved with Unicode (UTF-8) encoding. The <abbr title="Byte Order Mark">BOM</abbr> + should <em>not</em> be used. Unlike UTF-16 and UTF-32, there's no byte order to indicate in a UTF-8 encoded file, and the <abbr title="Byte Order Mark">BOM</abbr> can have a negative side effect in PHP of sending output, - preventing the application from being able to set its own headers. Unix line endings should + preventing the application from being able to set its own headers. Unix line endings should be used (LF).</p> - <p>Here is how to apply these settings in some of the more common text editors. Instructions for your + <p>Here is how to apply these settings in some of the more common text editors. Instructions for your text editor may vary; check your text editor's documentation.</p> <h5>TextMate</h5> @@ -137,8 +137,8 @@ Style Guide <h2><a name="php_closing_tag"></a>PHP Closing Tag</h2> <div class="guidelineDetails"> - <p>The PHP closing tag on a PHP document <strong>?></strong> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced - by the developer, user, or an FTP application, can cause unwanted output, PHP errors, or if the latter are suppressed, blank pages. For this reason, all PHP files should + <p>The PHP closing tag on a PHP document <strong>?></strong> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced + by the developer, user, or an FTP application, can cause unwanted output, PHP errors, or if the latter are suppressed, blank pages. For this reason, all PHP files should <strong>OMIT</strong> the closing PHP tag, and instead use a comment block to mark the end of file and it's location relative to the application root. This allows you to still identify a file as being complete and not truncated.</p> <code><strong>INCORRECT</strong>: @@ -161,7 +161,7 @@ echo "Here's my code!"; <h2><a name="class_and_method_naming"></a>Class and Method Naming</h2> <div class="guidelineDetails"> - <p>Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.</p> + <p>Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.</p> <code><strong>INCORRECT</strong>: class superclass @@ -184,7 +184,7 @@ class Super_class</code> <code><strong>INCORRECT</strong>: function fileproperties() // not descriptive and needs underscore separator function fileProperties() // not descriptive and uses CamelCase -function getfileproperties() // Better! But still missing underscore separator +function getfileproperties() // Better! But still missing underscore separator function getFileProperties() // uses CamelCase function get_the_file_properties_from_the_file() // wordy @@ -196,7 +196,7 @@ function get_file_properties() // descriptive, underscore separator, and all low <h2><a name="variable_names"></a>Variable Names</h2> <div class="guidelineDetails"> - <p>The guidelines for variable naming is very similar to that used for class methods. Namely, variables should contain only lowercase letters, use underscore separators, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.</p> + <p>The guidelines for variable naming is very similar to that used for class methods. Namely, variables should contain only lowercase letters, use underscore separators, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.</p> <code><strong>INCORRECT</strong>: $j = 'foo'; // single letter variables should only be used in for() loops $Str // contains uppercase letters @@ -216,7 +216,7 @@ $last_city <h2><a name="commenting"></a>Commenting</h2> <div class="guidelineDetails"> - <p>In general, code should be commented prolifically. It not only helps describe the flow and intent of the code for less experienced programmers, but can prove invaluable when returning to your own code months down the line. There is not a required format for comments, but the following are recommended.</p> + <p>In general, code should be commented prolifically. It not only helps describe the flow and intent of the code for less experienced programmers, but can prove invaluable when returning to your own code months down the line. There is not a required format for comments, but the following are recommended.</p> <p><a href="http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblock">DocBlock</a> style comments preceding class and method declarations so they can be picked up by IDEs:</p> @@ -246,9 +246,9 @@ function xml_encode($str)</code> $parts = explode("\n", $str); // A longer comment that needs to give greater detail on what is -// occurring and why can use multiple single-line comments. Try to +// occurring and why can use multiple single-line comments. Try to // keep the width reasonable, around 70 characters is the easiest to -// read. Don't hesitate to link to permanent external resources +// read. Don't hesitate to link to permanent external resources // that may provide greater detail: // // http://example.com/information_about_something/in_particular/ @@ -260,7 +260,7 @@ $parts = $this->foo($parts); <h2><a name="constants"></a>Constants</h2> <div class="guidelineDetails"> - <p>Constants follow the same guidelines as do variables, except constants should always be fully uppercase. <em>Always use CodeIgniter constants when appropriate, i.e. SLASH, LD, RD, PATH_CACHE, etc.</em></p> + <p>Constants follow the same guidelines as do variables, except constants should always be fully uppercase. <em>Always use CodeIgniter constants when appropriate, i.e. SLASH, LD, RD, PATH_CACHE, etc.</em></p> <code><strong>INCORRECT</strong>: myConstant // missing underscore separator and not fully uppercase N // no single-letter constants @@ -298,7 +298,7 @@ function foo($bar = NULL)</code> <strong>&&</strong> is preferred over <strong>AND</strong> but either are acceptable, and a space should always precede and follow <strong>!</strong>.</p> <code><strong>INCORRECT</strong>: if ($foo || $bar) -if ($foo AND $bar) // okay but not recommended for common syntax highlighting applications +if ($foo AND $bar) // okay but not recommended for common syntax highlighting applications if (!$foo) if (! is_array($foo)) @@ -314,8 +314,8 @@ if ( ! is_array($foo)) <h2><a name="comparing_return_values_and_typecasting"></a>Comparing Return Values and Typecasting</h2> <div class="guidelineDetails"> - <p>Some PHP functions return FALSE on failure, but may also have a valid return value of "" or 0, which would evaluate to FALSE in loose comparisons. Be explicit by comparing the variable type when using these return values in conditionals to ensure the return value is indeed what you expect, and not a value that has an equivalent loose-type evaluation.</p> - <p>Use the same stringency in returning and checking your own variables. Use <strong>===</strong> and <strong>!==</strong> as necessary. + <p>Some PHP functions return FALSE on failure, but may also have a valid return value of "" or 0, which would evaluate to FALSE in loose comparisons. Be explicit by comparing the variable type when using these return values in conditionals to ensure the return value is indeed what you expect, and not a value that has an equivalent loose-type evaluation.</p> + <p>Use the same stringency in returning and checking your own variables. Use <strong>===</strong> and <strong>!==</strong> as necessary. <code><strong>INCORRECT</strong>: // If 'foo' is at the beginning of the string, strpos will return a 0, @@ -329,7 +329,7 @@ if (strpos($str, 'foo') === FALSE) <code><strong>INCORRECT</strong>: function build_string($str = "") { - if ($str == "") // uh-oh! What if FALSE or the integer 0 is passed as an argument? + if ($str == "") // uh-oh! What if FALSE or the integer 0 is passed as an argument? { } @@ -344,7 +344,7 @@ function build_string($str = "") } }</code> - <p>See also information regarding <a href="http://us3.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting">typecasting</a>, which can be quite useful. Typecasting has a slightly different effect which may be desirable. When casting a variable as a string, for instance, NULL and boolean FALSE variables become empty strings, 0 (and other numbers) become strings of digits, and boolean TRUE becomes "1":</p> + <p>See also information regarding <a href="http://us3.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting">typecasting</a>, which can be quite useful. Typecasting has a slightly different effect which may be desirable. When casting a variable as a string, for instance, NULL and boolean FALSE variables become empty strings, 0 (and other numbers) become strings of digits, and boolean TRUE becomes "1":</p> <code>$str = (string) $str; // cast $str as a string</code> @@ -362,7 +362,7 @@ function build_string($str = "") <h2><a name="whitespace_in_files"></a>Whitespace in Files</h2> <div class="guidelineDetails"> - <p>No whitespace can precede the opening PHP tag or follow the closing PHP tag. Output is buffered, so whitespace in your files can cause output to begin before CodeIgniter outputs its content, leading to errors and an inability for CodeIgniter to send proper headers. In the examples below, select the text with your mouse to reveal the incorrect whitespace.</p> + <p>No whitespace can precede the opening PHP tag or follow the closing PHP tag. Output is buffered, so whitespace in your files can cause output to begin before CodeIgniter outputs its content, leading to errors and an inability for CodeIgniter to send proper headers. In the examples below, select the text with your mouse to reveal the incorrect whitespace.</p> <p><strong>INCORRECT</strong>:</p> <code> @@ -381,14 +381,14 @@ function build_string($str = "") <h2><a name="compatibility"></a>Compatibility</h2> <div class="guidelineDetails"> - <p>Unless specifically mentioned in your add-on's documentation, all code must be compatible with PHP version 5.1+. Additionally, do not use PHP functions that require non-default libraries to be installed unless your code contains an alternative method when the function is not available, or you implicitly document that your add-on requires said PHP libraries.</p> + <p>Unless specifically mentioned in your add-on's documentation, all code must be compatible with PHP version 5.1+. Additionally, do not use PHP functions that require non-default libraries to be installed unless your code contains an alternative method when the function is not available, or you implicitly document that your add-on requires said PHP libraries.</p> </div> <h2><a name="class_and_file_names_using_common_words"></a>Class and File Names using Common Words</h2> <div class="guidelineDetails"> - <p>When your class or filename is a common word, or might quite likely be identically named in another PHP script, provide a unique prefix to help prevent collision. Always realize that your end users may be running other add-ons or third party PHP scripts. Choose a prefix that is unique to your identity as a developer or company.</p> + <p>When your class or filename is a common word, or might quite likely be identically named in another PHP script, provide a unique prefix to help prevent collision. Always realize that your end users may be running other add-ons or third party PHP scripts. Choose a prefix that is unique to your identity as a developer or company.</p> <code><strong>INCORRECT</strong>: class Email pi.email.php @@ -405,7 +405,7 @@ class Pre_import mod.pre_import.php <h2><a name="database_table_names"></a>Database Table Names</h2> <div class="guidelineDetails"> - <p>Any tables that your add-on might use must use the 'exp_' prefix, followed by a prefix uniquely identifying you as the developer or company, and then a short descriptive table name. You do not need to be concerned about the database prefix being used on the user's installation, as CodeIgniter's database class will automatically convert 'exp_' to what is actually being used.</p> + <p>Any tables that your add-on might use must use the 'exp_' prefix, followed by a prefix uniquely identifying you as the developer or company, and then a short descriptive table name. You do not need to be concerned about the database prefix being used on the user's installation, as CodeIgniter's database class will automatically convert 'exp_' to what is actually being used.</p> <code><strong>INCORRECT</strong>: email_addresses // missing both prefixes @@ -416,35 +416,35 @@ exp_email_addresses // missing unique prefix exp_pre_email_addresses </code> - <p class="important"><strong>NOTE:</strong> Be mindful that MySQL has a limit of 64 characters for table names. This should not be an issue as table names that would exceed this would likely have unreasonable names. For instance, the following table name exceeds this limitation by one character. Silly, no? <strong>exp_pre_email_addresses_of_registered_users_in_seattle_washington</strong> + <p class="important"><strong>NOTE:</strong> Be mindful that MySQL has a limit of 64 characters for table names. This should not be an issue as table names that would exceed this would likely have unreasonable names. For instance, the following table name exceeds this limitation by one character. Silly, no? <strong>exp_pre_email_addresses_of_registered_users_in_seattle_washington</strong> </div> <h2><a name="one_file_per_class"></a>One File per Class</h2> <div class="guidelineDetails"> - <p>Use separate files for each class your add-on uses, unless the classes are <em>closely related</em>. An example of CodeIgniter files that contains multiple classes is the Database class file, which contains both the DB class and the DB_Cache class, and the Magpie plugin, which contains both the Magpie and Snoopy classes.</p> + <p>Use separate files for each class your add-on uses, unless the classes are <em>closely related</em>. An example of CodeIgniter files that contains multiple classes is the Database class file, which contains both the DB class and the DB_Cache class, and the Magpie plugin, which contains both the Magpie and Snoopy classes.</p> </div> <h2><a name="whitespace"></a>Whitespace</h2> <div class="guidelineDetails"> - <p>Use tabs for whitespace in your code, not spaces. This may seem like a small thing, but using tabs instead of whitespace allows the developer looking at your code to have indentation at levels that they prefer and customize in whatever application they use. And as a side benefit, it results in (slightly) more compact files, storing one tab character versus, say, four space characters.</p> + <p>Use tabs for whitespace in your code, not spaces. This may seem like a small thing, but using tabs instead of whitespace allows the developer looking at your code to have indentation at levels that they prefer and customize in whatever application they use. And as a side benefit, it results in (slightly) more compact files, storing one tab character versus, say, four space characters.</p> </div> <h2><a name="line_breaks"></a>Line Breaks</h2> <div class="guidelineDetails"> - <p>Files must be saved with Unix line breaks. This is more of an issue for developers who work in Windows, but in any case ensure that your text editor is setup to save files with Unix line breaks.</p> + <p>Files must be saved with Unix line breaks. This is more of an issue for developers who work in Windows, but in any case ensure that your text editor is setup to save files with Unix line breaks.</p> </div> <h2><a name="code_indenting"></a>Code Indenting</h2> <div class="guidelineDetails"> - <p>Use Allman style indenting. With the exception of Class declarations, braces are always placed on a line by themselves, and indented at the same level as the control statement that "owns" them.</p> + <p>Use Allman style indenting. With the exception of Class declarations, braces are always placed on a line by themselves, and indented at the same level as the control statement that "owns" them.</p> <code><strong>INCORRECT</strong>: function foo($bar) { @@ -501,7 +501,7 @@ for ($i = 0; $i < 10; $i++) <h2><a name="bracket_spacing"></a>Bracket and Parenthetic Spacing</h2> <div class="guidelineDetails"> - <p>In general, parenthesis and brackets should not use any additional spaces. The exception is that a space should always follow PHP control structures that accept arguments with parenthesis (declare, do-while, elseif, for, foreach, if, switch, while), to help distinguish them from functions and increase readability.</p> + <p>In general, parenthesis and brackets should not use any additional spaces. The exception is that a space should always follow PHP control structures that accept arguments with parenthesis (declare, do-while, elseif, for, foreach, if, switch, while), to help distinguish them from functions and increase readability.</p> <code>INCORRECT: $arr[ $foo ] = 'foo'; @@ -558,9 +558,9 @@ _convert_text() // private method</code> <h2><a name="php_errors"></a>PHP Errors</h2> <div class="guidelineDetails"> - <p>Code must run error free and not rely on warnings and notices to be hidden to meet this requirement. For instance, never access a variable that you did not set yourself (such as $_POST array keys) without first checking to see that it isset().</p> + <p>Code must run error free and not rely on warnings and notices to be hidden to meet this requirement. For instance, never access a variable that you did not set yourself (such as $_POST array keys) without first checking to see that it isset().</p> - <p>Make sure that while developing your add-on, error reporting is enabled for ALL users, and that display_errors is enabled in the PHP environment. You can check this setting with:</p> + <p>Make sure that while developing your add-on, error reporting is enabled for ALL users, and that display_errors is enabled in the PHP environment. You can check this setting with:</p> <code>if (ini_get('display_errors') == 1) { @@ -571,7 +571,7 @@ _convert_text() // private method</code> <code>ini_set('display_errors', 1);</code> - <p class="important"><strong>NOTE:</strong> Setting the <a href="http://us.php.net/manual/en/ref.errorfunc.php#ini.display-errors">display_errors</a> setting with ini_set() at runtime is not identical to having it enabled in the PHP environment. Namely, it will not have any effect if the script has fatal errors</p> + <p class="important"><strong>NOTE:</strong> Setting the <a href="http://us.php.net/manual/en/ref.errorfunc.php#ini.display-errors">display_errors</a> setting with ini_set() at runtime is not identical to having it enabled in the PHP environment. Namely, it will not have any effect if the script has fatal errors</p> </div> @@ -609,7 +609,7 @@ $bat = str_replace($foo, $bar, $bag); <h2><a name="strings"></a>Strings</h2> <div class="guidelineDetails"> - <p>Always use single quoted strings unless you need variables parsed, and in cases where you do need variables parsed, use braces to prevent greedy token parsing. You may also use double-quoted strings if the string contains single quotes, so you do not have to use escape characters.</p> + <p>Always use single quoted strings unless you need variables parsed, and in cases where you do need variables parsed, use braces to prevent greedy token parsing. You may also use double-quoted strings if the string contains single quotes, so you do not have to use escape characters.</p> <code><strong>INCORRECT</strong>: "My String" // no variable parsing, so no use for double quotes diff --git a/user_guide/general/urls.html b/user_guide/general/urls.html index b975b701f..421f51301 100644 --- a/user_guide/general/urls.html +++ b/user_guide/general/urls.html @@ -58,7 +58,7 @@ URLS <h1>CodeIgniter URLs</h1> -<p>By default, URLs in CodeIgniter are designed to be search-engine and human friendly. Rather than using the standard "query string" +<p>By default, URLs in CodeIgniter are designed to be search-engine and human friendly. Rather than using the standard "query string" approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a <strong>segment-based</strong> approach:</p> <code>example.com/<var>news</var>/<dfn>article</dfn>/<samp>my_article</samp></code> @@ -78,7 +78,7 @@ approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a <st </ol> <p>The <a href="../libraries/uri.html">URI Class</a> and the <a href="../helpers/url_helper.html">URL Helper</a> -contain functions that make it easy to work with your URI data. In addition, your URLs can be remapped using the +contain functions that make it easy to work with your URI data. In addition, your URLs can be remapped using the <a href="routing.html">URI Routing</a> feature for more flexibility.</p> @@ -103,7 +103,7 @@ a request for your index.php file.</p> <h2>Adding a URL Suffix</h2> <p>In your <dfn>config/config.php</dfn> file you can specify a suffix that will be added to all URLs generated -by CodeIgniter. For example, if a URL is this:</p> +by CodeIgniter. For example, if a URL is this:</p> <code>example.com/index.php/products/view/shoes</code> @@ -125,7 +125,7 @@ open your config file you'll see these items:</p> $config['controller_trigger'] = 'c';<br /> $config['function_trigger'] = 'm';</code> -<p>If you change "enable_query_strings" to TRUE this feature will become active. Your controllers and functions will then +<p>If you change "enable_query_strings" to TRUE this feature will become active. Your controllers and functions will then be accessible using the "trigger" words you've set to invoke your controllers and methods:</p> <code>index.php?c=controller&m=method</code> diff --git a/user_guide/general/views.html b/user_guide/general/views.html index ece746592..ad93f4bc7 100644 --- a/user_guide/general/views.html +++ b/user_guide/general/views.html @@ -61,7 +61,7 @@ Views In fact, views can flexibly be embedded within other views (within other views, etc., etc.) if you need this type of hierarchy.</p> -<p>Views are never called directly, they must be loaded by a <a href="controllers.html">controller</a>. Remember that in an MVC framework, the Controller acts as the +<p>Views are never called directly, they must be loaded by a <a href="controllers.html">controller</a>. Remember that in an MVC framework, the Controller acts as the traffic cop, so it is responsible for fetching a particular view. If you have not read the <a href="controllers.html">Controllers</a> page you should do so before continuing.</p> @@ -90,7 +90,7 @@ you should do so before continuing.</p> <code>$this->load->view('<var>name</var>');</code> -<p>Where <var>name</var> is the name of your view file. Note: The .php file extension does not need to be specified unless you use something other than <kbd>.php</kbd>.</p> +<p>Where <var>name</var> is the name of your view file. Note: The .php file extension does not need to be specified unless you use something other than <kbd>.php</kbd>.</p> <p>Now, open the controller file you made earlier called <dfn>blog.php</dfn>, and replace the echo statement with the view loading function:</p> @@ -109,19 +109,19 @@ class Blog extends CI_Controller { </textarea> -<p>If you visit your site using the URL you did earlier you should see your new view. The URL was similar to this:</p> +<p>If you visit your site using the URL you did earlier you should see your new view. The URL was similar to this:</p> <code>example.com/index.php/<var>blog</var>/</code> <h2>Loading multiple views</h2> -<p>CodeIgniter will intelligently handle multiple calls to $this->load->view from within a controller. If more than one call happens they will be appended together. For example, you may wish to have a header view, a menu view, a content view, and a footer view. That might look something like this:</p> +<p>CodeIgniter will intelligently handle multiple calls to $this->load->view from within a controller. If more than one call happens they will be appended together. For example, you may wish to have a header view, a menu view, a content view, and a footer view. That might look something like this:</p> <p><code><?php<br /> <br /> class Page extends CI_Controller {<br /><br /> function index()<br /> {<br /> - $data['page_title'] = 'Your title';<br /> + $data['page_title'] = 'Your title';<br /> $this->load->view('header');<br /> $this->load->view('menu');<br /> $this->load->view('content', $data);<br /> @@ -132,8 +132,8 @@ class Page extends CI_Controller {<br /><br /> ?></code></p> <p>In the example above, we are using "dynamically added data", which you will see below.</p> <h2>Storing Views within Sub-folders</h2> -<p>Your view files can also be stored within sub-folders if you prefer that type of organization. When doing so you will need -to include the folder name loading the view. Example:</p> +<p>Your view files can also be stored within sub-folders if you prefer that type of organization. When doing so you will need +to include the folder name loading the view. Example:</p> <code>$this->load->view('<kbd>folder_name</kbd>/<var>file_name</var>');</code> @@ -159,7 +159,7 @@ $this->load->view('blogview', <var>$data</var>);</code> <p>Note: If you use an object, the class variables will be turned into array elements.</p> -<p>Let's try it with your controller file. Open it add this code:</p> +<p>Let's try it with your controller file. Open it add this code:</p> <textarea class="textarea" style="width:100%" cols="50" rows="14"> <?php @@ -195,8 +195,8 @@ class Blog extends CI_Controller { <h2>Creating Loops</h2> -<p>The data array you pass to your view files is not limited to simple variables. You can -pass multi dimensional arrays, which can be looped to generate multiple rows. For example, if you +<p>The data array you pass to your view files is not limited to simple variables. You can +pass multi dimensional arrays, which can be looped to generate multiple rows. For example, if you pull data from your database it will typically be in the form of a multi-dimensional array.</p> <p>Here's a simple example. Add this to your controller:</p> @@ -243,15 +243,15 @@ class Blog extends CI_Controller { </body> </html> </textarea> -<p><strong>Note:</strong> You'll notice that in the example above we are using PHP's alternative syntax. If you +<p><strong>Note:</strong> You'll notice that in the example above we are using PHP's alternative syntax. If you are not familiar with it you can read about it <a href="alternative_php.html">here</a>.</p> <h2>Returning views as data</h2> <p>There is a third <strong>optional</strong> parameter lets you change the behavior of the function so that it returns data as a string -rather than sending it to your browser. This can be useful if you want to process the data in some way. If you -set the parameter to <kbd>true</kbd> (boolean) it will return data. The default behavior is <kbd>false</kbd>, which sends it -to your browser. Remember to assign it to a variable if you want the data returned:</p> +rather than sending it to your browser. This can be useful if you want to process the data in some way. If you +set the parameter to <kbd>true</kbd> (boolean) it will return data. The default behavior is <kbd>false</kbd>, which sends it +to your browser. Remember to assign it to a variable if you want the data returned:</p> <code>$string = $this->load->view('<var>myfile</var>', '', <kbd>true</kbd>);</code> |