Load Libraries - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: Load Libraries (/showthread.php?tid=69314) |
Load Libraries - Batman - 11-03-2017 **New to CI** I have read the documentation and the Practice CodeIgniter 3. I can not seem to figure out how to load my own library in 'application/libraries/TestLib'. Tried : PHP Code: $this->load->library('TestLib'); PHP Code: $testLib = new App\Libraries\TestLib(); I've been looking all over but haven't seemed to figure out why it is not loading. CodeIgniter-3.1.6 RE: Load Libraries - ciadmin - 11-03-2017 CI will look for the UCfirst name of a libarary, namely "Testlib" in your case. On Windows, "TestLib" would be found, but not on Linux, because of case sensitivity. I recommend changing the name to conform to the style guide... https://www.codeigniter.com/user_guide/general/styleguide.html#class-and-method-naming RE: Load Libraries - Batman - 11-03-2017 Ok, so I have refactored the filename to 'Test_lib.php' and class name to Test_lib. Now what, It's still not found... RE: Load Libraries - ChicagoPhil - 11-03-2017 (11-03-2017, 04:45 PM)Batman Wrote: Ok, so I have refactored the filename to 'Test_lib.php' and class name to Test_lib. did you set up namespacing in CI3? That sounds like such an obvious question it's almost embarrassing to ask. RE: Load Libraries - Batman - 11-03-2017 I thought I did, but being new to CI, I must admit I may not have it done right. Do you have a resource to point to? RE: Load Libraries - Paradinight - 11-04-2017 https://www.codeigniter.com/user_guide/general/creating_libraries.html RE: Load Libraries - ChicagoPhil - 11-05-2017 If you set up namespacing you need to use the php use keyword at the top of your class. $this->load will not work. RE: Load Libraries - Sharter - 11-07-2018 I thought i did |