Welcome Guest, Not a member yet? Register   Sign In
creating my own library

Why mongo_db library is not loading?

class Mongo_Models {
  protected $mongo;

  public function __construct() {
    $CI =& get_instance();
    $this->mongo = $CI->load->library('mongo_db');

print_r($CI->load) it's ok, I can see the description of the object, but why CI can't find my mongo_db library? why I can make an autoload of mongo_db but I can't load the library inside my own library?

What are you trying to accomplish here? Is the mongo_db already loaded using the autoload functionality? Loading a library works different than a class try it like so
$this->load->library('mongo_db', 'mongolib')
this will make the library availabre under $CI->mongolib

Then you would be able to make it available under $this->mongo as such
$this->mongo =& $CI->mongolib

Please see the userguide about this topic

You're loading it fine - you're just confused because $this->load->library() doesn't actually return the library instance. It's assigned to A CI property, as Jeroen explained. Reference that and you're golden.

Theme © iAndrew 2016 - Forum software by © MyBB