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

[eluser]a77icu5[/eluser]
Why mongo_db library is not loading?

Code:
class Mongo_Models {
  
  protected $mongo;

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

[eluser]a77icu5[/eluser]
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?
#3

[eluser]Clooner[/eluser]
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
Code:
$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
Code:
$this->mongo =& $CI->mongolib


Please see the userguide about this topic
http://ellislab.com/codeigniter/user-gui...aries.html
#4

[eluser]Aken[/eluser]
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