diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-05-18 05:57:40 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-05-18 05:57:40 +0200 |
commit | c8b21742927c217770e950005741850f17b5d32c (patch) | |
tree | 296f0215049159272a97246e1b4895304cfb70a1 /user_guide | |
parent | 859407fbefb2cc44089a7af411b4a62446e5c909 (diff) |
documented load->model in the Loader docs
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/general/models.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/loader.html | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/user_guide/general/models.html b/user_guide/general/models.html index c0d972683..2759f0219 100644 --- a/user_guide/general/models.html +++ b/user_guide/general/models.html @@ -164,7 +164,7 @@ To load a model you will use the following function:</p> <p>If you 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('blog/queries');</code>
+<code>$this->load->model('<var>blog/queries</var>');</code>
<p>Once loaded, you will access your model functions using an object with the same name as your class:</p>
diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html index c9b0bfee4..8cf5478e8 100644 --- a/user_guide/libraries/loader.html +++ b/user_guide/libraries/loader.html @@ -103,8 +103,16 @@ to your browser. Remember to assign it to a variable if you want the data retur <code>$string = $this->load->view('<var>myfile</var>', '', <kbd>true</kbd>);</code>
+<h2>$this->load->model('<var>Model_name</var>');</h2>
+<p><code>$this->load->model('<var>Model_name</var>');</code></p>
+<p>If you model is located in a sub-folder, include the relative path from your models folder. For example, if you have a model located at application/models/blog/queries.php you'll load it using:</p>
+<p><code>$this->load->model('<var>blog/queries</var>');</code></p>
+<p>If you would like your model assigned to a different object name you can specify it via the second parameter of the loading
+ function:</p>
+<code> $this->load->model('<var>Model_name</var>', '<kbd>fubar</kbd>');<br />
+<br />
+$this-><kbd>fubar</kbd>->function();</code>
<h2>$this->load->database('<var>options</var>', <kbd>true/false</kbd>)</h2>
-
<p>This function lets you load the database class. The two parameters are <strong>optional</strong>. Please see the
<a href="./database/index.html">database</a> section for more info.</p>
|