diff --git a/_incl_data/autoload.php b/_incl_data/autoload.php index d5f54a2b..55f7e9ac 100644 --- a/_incl_data/autoload.php +++ b/_incl_data/autoload.php @@ -9,11 +9,12 @@ require_once 'mysql_override.php'; require_once 'class/Insallah/Config.php'; spl_autoload_register(function (string $className) { + $rootdir = getcwd() . '/_incl_data'; # 1 with namespaces # 2 without $fileName = [ - __DIR__ . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'), - __DIR__ . '/class/' . $className . '.php' + $rootdir . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'), + $rootdir . '/class/' . $className . '.php' ]; foreach ($fileName as $file) { if (file_exists($file)) { @@ -24,10 +25,11 @@ spl_autoload_register(function (string $className) { }); spl_autoload_register(function (string $classname) { + $rootdir = getcwd() . '/_incl_data'; $classMap = [ - 'NewCombats' => __DIR__ . '/class/', - 'Insallah' => __DIR__ . '/class/Insallah/', - 'DarksLight2' => __DIR__ . '/class/DarksLight2/', + 'NewCombats' => $rootdir . '/class/', + 'Insallah' => $rootdir . '/class/Insallah/', + 'DarksLight2' => $rootdir . '/class/DarksLight2/', ]; $parts = explode('\\', $classname); $namespace = array_shift($parts);