CodeIgniter Forums
BUG - autoloading user-created libraries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: Issues (https://forum.codeigniter.com/forum-19.html)
+--- Thread: BUG - autoloading user-created libraries (/thread-61833.html)



BUG - autoloading user-created libraries - yNAXON - 05-22-2015

Hello all,

found an error with autoloading custom libraries, getting next error:

Fatal error: Class 'CI_Layout' not found in ...\system\core\Common.php on line 196

my class name is Layout

I explored this file, and found out it adds CI_ automatically to class name.

but if I change class name to CI_Layout, it tells me

"Non-existent class: Rb"


RE: BUG - autoloading user-created libraries - InsiteFX - 05-23-2015

If it is your own library then it goes in ./application/libraries.
If it is a library that extends a CI library then it goes in ./application/core.

You never place your code in the CI system folder!


RE: BUG - autoloading user-created libraries - Hobbes - 05-25-2015

as InsiteFX said user created libraries go in : application/libraries

to auto load the library open: application/config/autoload.php

add the library name to the autoload['libraries'] array. EG: autoload['libraries'] = array('my_lib');

this is all covered in the documentation.