diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/Bootstrap.php b/Bootstrap.php old mode 100755 new mode 100644 index d8d439f..367d115 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -22,7 +22,7 @@ define('EXT', '.php'); // Directory separator (Unix-Style works on all OS) -define('DS', '/'); +define('DS', DIRECTORY_SEPARATOR); // Absolute path to the system folder define('SP', realpath(__DIR__). DS); @@ -37,7 +37,7 @@ // The current site path define('PATH', parse_url(getenv('REQUEST_URI'), PHP_URL_PATH)); -require(SP . 'vendor/autoload' . EXT); +require(SP . 'vendor' . DS . 'autoload' . EXT); // Include common system functions require(SP . 'Common' . EXT); diff --git a/Class/MyController.php b/Class/MyController.php old mode 100755 new mode 100644 index 37d2458..27dbdf2 --- a/Class/MyController.php +++ b/Class/MyController.php @@ -64,15 +64,12 @@ public function send() headers_sent() OR header('Content-Type: text/html; charset=utf-8'); $layout = new \Micro\View($this->template); + + if(config()->debug_mode) + $this->debug = new \Micro\View('System/Debug'); + $layout->set((array) $this); print $layout; - - $layout = NULL; - - if(config()->debug_mode) - { - print new \Micro\View('System/Debug'); - } } } diff --git a/Common.php b/Common.php old mode 100755 new mode 100644 index 519d5e9..87907b9 --- a/Common.php +++ b/Common.php @@ -66,7 +66,7 @@ function config($file = 'Config', $clear = FALSE) if(empty($configs[$file])) { //$configs[$file] = new \Micro\Config($file); - require(SP . 'Config/' . $file . EXT); + require(SP . 'Config' . DS . $file . EXT); $configs[$file] = (object) $config; //print dump($configs); } diff --git a/Public/index.php b/Public/index.php old mode 100755 new mode 100644 index 8d90818..c0044c7 --- a/Public/index.php +++ b/Public/index.php @@ -14,6 +14,12 @@ // Include bootstrap require('../Bootstrap.php'); +//Define prefix URI sub-floder +define('PREFIX_URI', NULL); + +//Replace uri path +$path = str_ireplace(PREFIX_URI, '', PATH); + try { // Anything else before we start? @@ -23,7 +29,7 @@ $dispatch = new \Micro\Dispatch(config('Route')->routes); // Run controller based on URL path and HTTP request method - $controller = $dispatch->controller(PATH, getenv('REQUEST_METHOD')); + $controller = $dispatch->controller($path, getenv('REQUEST_METHOD')); // Send the controller response $controller->send();