EllisLab text mark
Advanced Search
     
Documentation Error
Posted: 28 June 2007 09:20 PM   [ Ignore ]
Joined: 2006-03-02
8 posts

On this page, there is an error.

In the example model, the following is found:

class Blogmodel extends Model {

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

However, later on, the naming convention is different.

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.

 
Posted: 29 June 2007 12:32 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-23
3194 posts

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.

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design

 
Posted: 19 September 2007 06:10 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-02-09
14 posts

Hi there,

in the docs on page:
Docs -> Model

you can read the following example 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?

 
Posted: 19 September 2007 06:24 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2007-07-30
2144 posts

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.

 Signature 

Follow me on twitter here.
MichaelWales.com | MichaelWales.info