diff --git a/src/Core/Kernel/Templating.php b/src/Core/Kernel/Templating.php index b278a2a..f59a8fb 100644 --- a/src/Core/Kernel/Templating.php +++ b/src/Core/Kernel/Templating.php @@ -15,7 +15,8 @@ class Templating { $this->_views = ROOT . DS . "views"; $this->_cache = ROOT . DS . "cache"; - $this->_blade = new BladeOne($this->_views, $this->_cache, BladeOne::MODE_AUTO); + $mode = ($this->isDebug()) ? BladeOne::MODE_AUTO : BladeOne::MODE_FAST; + $this->_blade = new BladeOne($this->_views, $this->_cache, $mode); } public static function getInstance() @@ -26,6 +27,15 @@ class Templating return self::$_instance; } + private function isDebug(): bool + { + $ret = true; + if (isset($_ENV["DEBUG"])) { + $ret = ($_ENV["DEBUG"] == "true"); + } + return $ret; + } + public function render(string $template, array $params = []): string { return $this->_blade->run($template, $params);