gestion base sqlite dans répertoire databases, ajout mode fast si pas debug dans le templating

This commit is contained in:
Gregory Letellier
2023-11-13 11:19:53 +01:00

View File

@@ -15,7 +15,8 @@ class Templating
{ {
$this->_views = ROOT . DS . "views"; $this->_views = ROOT . DS . "views";
$this->_cache = ROOT . DS . "cache"; $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() public static function getInstance()
@@ -26,6 +27,15 @@ class Templating
return self::$_instance; 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 public function render(string $template, array $params = []): string
{ {
return $this->_blade->run($template, $params); return $this->_blade->run($template, $params);