creating my own library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: creating my own library (/showthread.php?tid=53908) |
creating my own library - El Forum - 08-13-2012 [eluser]a77icu5[/eluser] Why mongo_db library is not loading? Code: class Mongo_Models { creating my own library - El Forum - 08-14-2012 [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? creating my own library - El Forum - 08-14-2012 [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') 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-guide/general/libraries.html creating my own library - El Forum - 08-15-2012 [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. |