summaryrefslogtreecommitdiffstats
path: root/user_guide/general/models.html
diff options
context:
space:
mode:
authorphilsturgeon <devnull@localhost>2011-06-15 17:00:03 +0200
committerphilsturgeon <devnull@localhost>2011-06-15 17:00:03 +0200
commit0fe54dbaf89a8337d27b9203f74891cf1a799715 (patch)
treece168b3c24788e5a4a31e0cc65b64f54e25ee8a2 /user_guide/general/models.html
parent3a43c7adae7737d68a0eeca663cc2dd3fc5b0cf3 (diff)
parent3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff)
Merged Alex Bilbies MSSQL changes.
Diffstat (limited to 'user_guide/general/models.html')
-rw-r--r--user_guide/general/models.html20
1 files changed, 10 insertions, 10 deletions
diff --git a/user_guide/general/models.html b/user_guide/general/models.html
index 9afec7ef2..c0e494351 100644
--- a/user_guide/general/models.html
+++ b/user_guide/general/models.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.0</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.0.2</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -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&nbsp;Blogmodel&nbsp;extends&nbsp;CI_Model&nbsp;{<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-&gt;input-&gt;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-&gt;input-&gt;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&nbsp;<var>Model_name</var>&nbsp;extends&nbsp;CI_Model&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<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&nbsp;<var>User_model</var>&nbsp;extends&nbsp;CI_Model&nbsp;{<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&nbsp;Blog_controller&nbsp;extends&nbsp;CI_Controller&nbsp;{<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>