Create new ROOT_CORE constant.

This commit is contained in:
KJ 2024-05-09 18:36:48 -04:00
parent f5f803dde2
commit c65fcd27c8
2 changed files with 5 additions and 3 deletions

View File

@ -1,12 +1,14 @@
<?php <?php
require_once('config.php'); require_once('config.php');
define('ROOT_CORE', ROOT_DIR.'/src');
// Incluir clases // Incluir clases
spl_autoload_register(function ($className) { spl_autoload_register(function ($className) {
$fp = str_replace('\\','/',$className); $fp = str_replace('\\','/',$className);
$name = basename($fp); $name = basename($fp);
$dir = dirname($fp); $dir = dirname($fp);
$file = ROOT_DIR.'/src/'.$dir.'/'.$name.'.php'; $file = ROOT_CORE.'/'.$dir.'/'.$name.'.php';
if (file_exists($file)) { if (file_exists($file)) {
require_once $file; require_once $file;
return; return;
@ -14,7 +16,7 @@ spl_autoload_register(function ($className) {
}); });
// Incluir routers // Incluir routers
$routers = glob(ROOT_DIR.'/src/Routers/*.php'); $routers = glob(ROOT_CORE.'/Routers/*.php');
foreach($routers as $file){ foreach($routers as $file){
require_once($file); require_once($file);

View File

@ -36,7 +36,7 @@ class View extends Neuron {
return; return;
} }
include(ROOT_DIR."/src/Views/$viewName.$extension"); include(ROOT_CORE."/Views/$viewName.$extension");
} }
/** /**