Hello !
As you’ve done well for controllers, models and viexs, would it be possible to do so for libraries.
I began to have lots of libraries and I think I am not the only one !
function _ci_load_class($class, $params = NULL)
{
// Prep the class name
$class = ucfirst(strtolower(str_replace(EXT, '', $class)));
// Is this a class extension request?
if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
{
if ( ! file_exists(BASEPATH.'libraries/'.$class.EXT))
{
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
}
include(BASEPATH.'libraries/'.ucfirst($class).EXT);
include(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
return $this->_ci_init_class($class, config_item('subclass_prefix'), $params);
}
// Lets search for the requested library file and load it.
for ($i = 1; $i < 3; $i++)
{
$path = ($i % 2) ? APPPATH : BASEPATH;
if (file_exists($path.'libraries/'.$class.EXT))
{
/** ACTUAL LINE **/
include_once($path.'libraries/'.$class.EXT);
/** WOULD BE NICE **/
if ( isset($params['directory']) && $path == BASEPATH ) {
$postPath = $params['directory'].'/';
}else{
$postPath = '';
}
include_once($path.'libraries/'.$postPath.$class.EXT);
return $this->_ci_init_class($class, '', $params);
}
}
// If we got this far we were unable to find the requested class
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
}
It will be very nice to do so if possible.
Thanks in advance whatever is done.
have a good day ... or night
