From d07792e3d85fef19f360bf40e4193daa0e199b77 Mon Sep 17 00:00:00 2001 From: Emmanuel ROY Date: Thu, 10 Dec 2020 14:29:31 +0100 Subject: [PATCH] update model engine choice --- application/class/Vue.php | 13 ++++++++++++- application/include/modeles/index.model | 1 + composer.json | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/application/class/Vue.php b/application/class/Vue.php index f3faa1b..50b3307 100644 --- a/application/class/Vue.php +++ b/application/class/Vue.php @@ -27,7 +27,18 @@ class Vue $paths->insert(VIEW_PATH . DIRECTORY_SEPARATOR . "layout", 200); $paths->insert(VIEW_PATH . DIRECTORY_SEPARATOR . "view", 300); - $renderer = new \Windwalker\Renderer\BladeRenderer($paths, array('cache_path' => VIEW_PATH . DIRECTORY_SEPARATOR . "cache")); + if(!isset($engine)){$engine = 'blade';} + + switch ($engine){ + case 'twig': + $renderer = new \Windwalker\Renderer\TwigRenderer($paths); + $name .= '.html'; + break; + case 'blade': + default: + $renderer = new \Windwalker\Renderer\BladeRenderer($paths, array('cache_path' => VIEW_PATH . DIRECTORY_SEPARATOR . "cache")); + } + //de base on ajoute les parametres du .model et ceux provenant de l'url foreach ($application->modele->page as $key => $value) { diff --git a/application/include/modeles/index.model b/application/include/modeles/index.model index 2de4062..d685945 100644 --- a/application/include/modeles/index.model +++ b/application/include/modeles/index.model @@ -1,5 +1,6 @@ name : index page_title : Accueil de l'application description : zatou stra bracadabla +engine : blade params : params diff --git a/composer.json b/composer.json index fa57900..6716737 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "symfony/expression-language": "~3.0", "symfony/config": "3.3.2", "michelf/php-markdown": "^1.9", - "apereo/phpcas": "^1.3" + "apereo/phpcas": "^1.3", + "twig/twig": "1.*" } }