Confusion regarding variables in a Model

#1
[eluser]Unknown[/eluser]
Hi All,

I am a bit confused with using variables in a Model. If you see this page: http://ellislab.com/codeigniter/user-gui....html#what the function get_last_ten_entries() uses $query while other functions use $this->title, $this->content etc. I am assuming they are referenced using $this->variablename because those variables are private to this Model class and each of them will be initialized separately for separate functions.

In other words $this->title in insert_entry() will be a different variable from $this->title in update_entry(). Just wanted to confirm if I am thinking right or not.

Thanks.

#2
[eluser]Nick_MyShuitings[/eluser]
Correct, they are just defining the names above for clarity in reading the model. As you see in each method they are overriding the variable's value.

#3
[eluser]danmontgomery[/eluser]
http://www.php.net/manual/en/language.oop5.basic.php


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.