By design, loading the CodeIgniter library can be done only once. Subsequent attempts to load the same library are ignored. You can (in some way) get around this by telling CI to create an instance of the class with a different name each time you load another copy of the library (see the answer to this question )
The best solution is probably to create your class yourself, instead of using the CI library loading mechanism. This way you can create and store as many copies as possible.
EDIT: I suggest leaving the class in the library directory and just use PHP include () to make it available to your models / controllers where necessary.
Regarding accessing CodeIgniter from your class, you can do this using the following code:
$CI =& get_instance(); $CI->load->helper('url'); $CI->load->library('session'); $CI->config->item('base_url');
The get_instance () function returns a CodeIgniter super object, and after it is assigned to the $ CI variable, you can access any of the CI methods as if you were from a model or controller, except for using $ CI instead of $ this. See this link for more details.
source share