Welcome Guest, Not a member yet? Register   Sign In
how to load a model with a parameter to construct the model....
#2

[eluser]darkhouse[/eluser]
That would require changing the loader library I believe, as it's the class that would say $this->m_model = new M_model();

But instead of loading it in the constructor, why can't you just setup an init method, like this:

Code:
class M_model extends Model {

   private $user_id = NULL;

   public function __construct() {
      parent::Model ();
      //do something here…
   }

   public function init($user_id = NULL){
      if($user_id !== NULL) $this->user_id = $user_id;
   }

}


Messages In This Thread
how to load a model with a parameter to construct the model.... - by El Forum - 02-19-2009, 10:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB