diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-06-04 16:28:23 +0200 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-06-04 16:28:23 +0200 |
commit | 3902e383b41c6c0ef77b65e95d451cb2ea3d85db (patch) | |
tree | eb2adb1cf4f1dea1e4d14c69a3f1a275b14cff08 /user_guide_src/source/general/models.rst | |
parent | fd2ceab417bbb696134910ce0eaeca34bea3e1e5 (diff) | |
parent | fc11dcc82cefa7299e6f8c74d0e005ebb6fa568c (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into email
Diffstat (limited to 'user_guide_src/source/general/models.rst')
-rw-r--r-- | user_guide_src/source/general/models.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/user_guide_src/source/general/models.rst b/user_guide_src/source/general/models.rst index 0156b0460..87f63e416 100644 --- a/user_guide_src/source/general/models.rst +++ b/user_guide_src/source/general/models.rst @@ -16,7 +16,7 @@ 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:: - class Blogmodel extends CI_Model { + class Blog_model extends CI_Model { var $title = ''; var $content = ''; @@ -104,7 +104,7 @@ Your models will typically be loaded and called from within your :doc:`controller <controllers>` functions. To load a model you will use the following function:: - $this->load->model('Model_name'); + $this->load->model('model_name'); 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 @@ -115,14 +115,14 @@ application/models/blog/queries.php you'll load it using:: Once loaded, you will access your model functions using an object with the same name as your class:: - $this->load->model('Model_name'); + $this->load->model('model_name'); - $this->Model_name->function(); + $this->model_name->function(); If you would like your model assigned to a different object name you can specify it via the second parameter of the loading function:: - $this->load->model('Model_name', 'fubar'); + $this->load->model('model_name', 'fubar'); $this->fubar->function(); @@ -133,7 +133,7 @@ view:: function blog() { - $this->load->model('Blog'); + $this->load->model('blog'); $data['query'] = $this->Blog->get_last_ten_entries(); @@ -165,7 +165,7 @@ database. The following options for connecting are available to you: defined in your database config file will be used: :: - $this->load->model('Model_name', '', TRUE); + $this->load->model('model_name', '', TRUE); - You can manually pass database connectivity settings via the third parameter:: |