From b3612c2b0ae57d3bd3c724b3cc8f92ee3b2751cb Mon Sep 17 00:00:00 2001 From: fengqi Date: Tue, 25 Apr 2017 14:42:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=81=E8=AE=B8=E9=85=8D=E7=BD=AE=20smar?= =?UTF-8?q?ty=20=E7=9A=84=E5=BC=80=E5=A7=8B=E5=92=8C=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/config/view.php | 5 ++++- src/ViewSmarty.php | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/config/view.php b/examples/config/view.php index 81160aa..335f3e3 100644 --- a/examples/config/view.php +++ b/examples/config/view.php @@ -6,6 +6,9 @@ 'compile_dir' => base_path('app/View/Compile'), 'config_dir' => base_path('app/View/Config'), 'cache_dir' => base_path('app/View/Cache'), - 'caching' => 1 + 'plugin_dir' => base_path('app/View/Plugin'), + 'caching' => 1, + 'left_delimiter' => '{%', + 'right_delimiter' => '%}', ] ]; diff --git a/src/ViewSmarty.php b/src/ViewSmarty.php index dd316c9..aad2551 100644 --- a/src/ViewSmarty.php +++ b/src/ViewSmarty.php @@ -63,10 +63,13 @@ public function __construct($config) $smarty->setConfigDir($this->config['config_dir']); $smarty->setCacheDir($this->config['cache_dir']); $smarty->setCaching($this->config['caching']); + $smarty->addPluginsDir($this->config['plugin_dir']); + $smarty->left_delimiter = $this->config['left_delimiter']; + $smarty->right_delimiter = $this->config['right_delimiter']; $this->view = $smarty; - return $this->view; + return $this; } /** @@ -107,7 +110,7 @@ public function assign($key, $value) $this->viewVars = array_merge($this->viewVars, [$key => $value]); - return true; + return $this; } /** From 672c1cb52e9f1e5d14d558a336741fef7672b346 Mon Sep 17 00:00:00 2001 From: fengqi Date: Tue, 25 Apr 2017 14:42:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8D=A0=E5=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/.gitkeep diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 0000000..e69de29