Welcome Guest, Not a member yet? Register   Sign In
Using CI instance in a library
#1

[eluser]DarkManX[/eluser]
Hey guys,

i try to store the ci instance in a library variable when i contruct the it, but i doesnt work. i tried everything but cant solve it by myself. hope you can help!

Code:
class My_library{
public $CI = null;
function construct(){
  $this->CI =& get_instance();
}
public function foo(){
  // doesnt work, showing im trying to use a method of a non-object
  $this->CI->load->model('model_name');
  // this works fine
  $CI =& get_instance();
  $CI->load->model('model_name');
}
}

greets


Messages In This Thread
Using CI instance in a library - by El Forum - 08-21-2012, 09:50 AM
Using CI instance in a library - by El Forum - 08-21-2012, 09:56 AM
Using CI instance in a library - by El Forum - 08-21-2012, 11:39 AM
Using CI instance in a library - by El Forum - 08-21-2012, 12:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB