Added simple templates module

This commit is contained in:
Antonio de la Rosa 2025-11-23 01:26:30 +01:00
parent 47c7003e3b
commit 17b6df73ff
7 changed files with 265 additions and 38 deletions

View file

@ -17,32 +17,23 @@ if(is_file(__DIR__.'/vendor/autoload.php')) {
Utils::load_config('config');
/*spl_autoload_register(function ($class_name) {
//include($nombre_clase . '.php';
//echo $class_name;
switch($class_name) {
case 'PhangoApp\PDO\MySQL':
include('./libraries/PDO.php');
break;
}
});*/
spl_autoload_register(function($class_name) {
//Simple autoload for modules, first element is module, second element is the file to load.
$arr_library=explode('\\', $class_name);
$module=strtolower($arr_library[0]);
$library=strtolower($arr_library[1]);
if(count($arr_library)>1) {
include('modules/'.$module.'/libraries/'.$library.'.php');
$module=strtolower($arr_library[0]);
$library=strtolower($arr_library[1]);
if(is_file('modules/'.$module.'/libraries/'.$library.'.php')) {
include('modules/'.$module.'/libraries/'.$library.'.php');
}
}
});