Welcome Guest, Not a member yet? Register   Sign In
problem while adding Custom Libraries to CI3
#5

(This post was last modified: 07-03-2015, 02:26 AM by newdev.)

(07-03-2015, 01:24 AM)Narf Wrote: OK, then move it out of system/libraries/ and put it in application/libraries/ instead ... you're not supposed to touch  the system/ directory
this library is present inside application/libraries directory , i haven't touched the system/ directory, instead i have checked the common.php and found the code below and you can see that "CI_' is being concatenated with every class name whether it exists in /system/ or /application/
PHP Code:
function &load_class($class$directory 'libraries'$param NULL)
    {
        static 
$_classes = array();
        
// Does the class exist? If so, we're done...
        
if (isset($_classes[$class]))
        {
            return 
$_classes[$class];
        }

        
$name FALSE;

        
// Look for the class first in the local application/libraries folder
        // then in the native system/libraries folder
        
foreach (array(APPPATHBASEPATH) as $path)
        {
            if (
file_exists($path.$directory.'/'.$class.'.php'))
            {
                
$name 'CI_'.$class;
                if (
class_exists($nameFALSE) === FALSE)
                {
                    require_once(
$path.$directory.'/'.$class.'.php');
                }

                break;
            }
        }
        
// Is the request a class extension? If so we load it too
        
if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
        {
            
$name config_item('subclass_prefix').$class;

            if (
class_exists($nameFALSE) === FALSE)
            {
                require_once(
APPPATH.$directory.'/'.$name.'.php');
            }
        }

        
// Did we find the class?
        
if ($name === FALSE)
        {
            
// Note: We use exit() rather then show_error() in order to avoid a
            // self-referencing loop with the Exceptions class
            
set_status_header(503);
            echo 
'Unable to locate the specified class: '.$class.'.php';
            exit(
5); // EXIT_UNK_CLASS
        
}

        
// Keep track of what we just loaded
        
is_loaded($class);
        
$_classes[$class] = isset($param)
            ? new 
$name($param)
            : new 
$name();
        return 
$_classes[$class];
    }


don't know if there is a fix in the core files, or i am doing something wrong, but the same libraries in the same way worked with previous version and not working on this CI3
Reply


Messages In This Thread
RE: problem while adding Custom Libraries to CI3 - by newdev - 07-03-2015, 02:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB