Welcome Guest, Not a member yet? Register   Sign In
__autoload
#5

[eluser]Moon 111[/eluser]
I updated so that it ignored anything that couldn't be found in the models folder.

Code:
<?php

function __autoload($classname) {

    $handle = opendir(APPPATH . 'models/');
    
    while (false !== ($file = readdir($handle))) {
        $file_array[] = $file;
    }
    
    if(in_array(strtolower($classname) . '.php', $file_array))
        include APPPATH . 'models/' . strtolower($classname) . '.php';
}

?>


Messages In This Thread
__autoload - by El Forum - 10-02-2008, 07:49 AM
__autoload - by El Forum - 10-02-2008, 09:58 AM
__autoload - by El Forum - 10-02-2008, 10:25 AM
__autoload - by El Forum - 10-02-2008, 01:05 PM
__autoload - by El Forum - 10-02-2008, 01:45 PM
__autoload - by El Forum - 10-02-2008, 03:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB