I have a file structure that looks like this;
/
/public
-index.php
-login.php
/config.php
/init.php
/classes/ClassGroup/ClassName.class.php
__autoload is defined in config.php, with absolute path to classes. config.php is required in index.php, but when I try to initiate a new class;
$user = new User_User;
Results in;
Fatal error: Class 'User_User' not found in /......./public/index.php on line 27
It does not find it, and when trying to echo out something at the very start of __autoload(), it doesnt do that either, so it seems to me that it does not run the function when not finding a class. Anyone have a clue what the problem might be?
function __autoload($class){
//echo "autoloader started";
$pieces = explode('_', $class);
$path = __SITE_PATH.'/classes';
foreach( $pieces as $i ){
$path .= '/'.$i;
}
//echo "trying to include " .$path.".class.php";
require_once( $path . '.class.php' );
}