Welcome Guest, Not a member yet? Register   Sign In
Documentation Error
#1

[eluser]DennisP[/eluser]
On this page, there is an error.

In the example model, the following is found:

Code:
class Blogmodel extends Model {

    var $title   = '';
    var $content = '';
    var $date    = '';

However, later on, the naming convention is different.

Code:
class User_model extends Model {

    function User_model()
    {
        parent::Model();
    }
}

Am I missing something, or was there a typo? It's entirely possible I'm screwed up. I'm a n00b to CodeIgniter.
#2

[eluser]Derek Allard[/eluser]
Dennis, welcome to CodeIgniter! Great to have you on board. Those are actually supposed to be 2 separate examples, and by using 2 different names we can illustrate that the model names need to be Capitalized in more then 1 way.

Thanks for bringing it up though! We're always trying to improve the docs, so if you find anything else, don't hesitate to post it in our Bug Tracker.
#3

[eluser]uprocka[/eluser]
Hi there,

in the docs on page:
Docs -> Model

you can read the following example code:
Code:
function insert_entry()
    {
        $this->title   = $_POST['title'];
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->insert('entries', $this);
    }

This won't work - at least it did not for me,
because $this contains a lot more than just the three values above...

It this an ERROR and wrong example or am I doing something wrong?
#4

[eluser]Michael Wales[/eluser]
Not only does it not work, but it's bad practice as well - you should always validate each variable your are inputting into your database.




Theme © iAndrew 2016 - Forum software by © MyBB