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

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!

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 works fine
  $CI =& get_instance();


you construct function is wrong. it should be: function __construct() not: function construct().

notice the two underscores.

Ty, sometimes you just blind debugging your own code! Big Grin

np, glad i could help

Theme © iAndrew 2016 - Forum software by © MyBB