dynamic models

#1
[eluser]Darkbob[/eluser]
Hi,

Is it possible to instanciate models the same way we do with POPO (plain old php object Wink ).

The way I'm doing it right now is by doing a workaround by actually doing a custom class that contains the necessary attributes + a codeigniter model which has the methods Sad ...

I'm sure there is a better way to do this?

thanks

#2
[eluser]Colin Williams[/eluser]
application/models/apple_model.php:

Code:
class Apple_model extends Model {

   var $color = 'red';

  function set_color($color)
  {
    $this->color = $color;
  }

}

controller:

Code:
$this->load->model('apple_model');
$apple = new Apple_model();
$apple->set_color('green');


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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