Compare commits

...

2 Commits

Author SHA1 Message Date
Gregory Letellier
610ed871bb gestion base sqlite dans répertoire databases, ajout mode fast si pas debug dans le templating 2023-11-13 11:19:53 +01:00
Gregory Letellier
8d697f6f4f gestion base sqlite dans répertoire databases 2023-11-13 11:17:42 +01:00
2 changed files with 13 additions and 5 deletions

View File

@@ -66,10 +66,8 @@ class Application
$conn["PASSWORD"] = isset($_ENV[$this->getKey("PASSWORD", $key)]) ? $_ENV[$this->getKey("PASSWORD", $key)] : null;
$conn["DATABASE"] = isset($_ENV[$this->getKey("DATABASE", $key)]) ? $_ENV[$this->getKey("DATABASE", $key)] : null;
$conn["PORT"] = isset($_ENV[$this->getKey("PORT", $key)]) ? $_ENV[$this->getKey("PORT", $key)] : null;
if($conn["TYPE"] == "sqlite")
{
if(!is_file($conn["DATABASE"]))
{
if ($conn["TYPE"] == "sqlite") {
if (!is_file($conn["DATABASE"])) {
$conn["DATABASE"] = ROOT . DS . "databases" . DS . $conn["DATABASE"];
}
}

View File

@@ -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);