Skip to content

Commit

Permalink
Fixes #17: Fixed Smarty 2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Feb 2, 2017
1 parent 1e61f38 commit 520702f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yii Framework 2 smarty extension Change Log
2.0.6 under development
-----------------------

- no changes in this release.
- Bug #17: Fixed Smarty 2 compatibility (samdark)


2.0.5 March 17, 2016
Expand Down
10 changes: 9 additions & 1 deletion ViewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ class ViewRenderer extends BaseViewRenderer
public function init()
{
$this->smarty = new Smarty();
$this->smarty->setCompileDir(Yii::getAlias($this->compilePath));

if (method_exists($this->smarty, 'setCompileDir')) {
// Smarty 3
$this->smarty->setCompileDir(Yii::getAlias($this->compilePath));
} else {
// Smarty 2
$this->smarty->compile_dir = Yii::getAlias($this->compilePath);
}

$this->smarty->setCacheDir(Yii::getAlias($this->cachePath));

foreach ($this->options as $key => $value) {
Expand Down

0 comments on commit 520702f

Please sign in to comment.