PHP:
function autoLoader($className)
{
//Directories added here must be relative to the script going to use this file.
$directories = array
(
'../application/classes/*/'
);
//File naming formats
$fileNameFormats = array
(
'%s.class.php'
);
// this is to take care of the PEAR style of naming classes
$path = str_ireplace('_', '/', $className);
if(@include_once $path.'.php')
{
return;
}
foreach($directories as $directory)
{
foreach($fileNameFormats as $fileNameFormat)
{
$path = $directory.sprintf($fileNameFormat, $className);
if(file_exists($path))
{
include_once $path;
return;
}
}
}
}
spl_autoload_register('autoLoader');
I seem to be missing the logic some where as i just can't get this to work, my error log is reporting it can't find the class in the directory i am pointing too.