风火雷 / yii2-smartyviewer
Yii框架2+的Smarty Viewer集成
1.0.3
2015-05-14 09:21 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-28 18:05:13 UTC
README
此扩展提供了一个ViewRender,允许您使用Smarty视图模板引擎。
要使用此扩展,只需将以下代码添加到您的应用程序配置和Web控制器中
xxx/config/main.php
return [
//....
'components' => [
'smarty' => [
'class' => 'yii\smartyviewer\SmartyViewer',
//'themeName' => 'basic',
//'cachePath' => '@runtime/Smarty/cache',
//'options' => [
// 'left_delimiter' => '<{',
// 'right_delimiter' => '}>',
//],
],
],
];
XxxxController.php
public function init()
{
Yii::$app->smarty->init();
parent::init();
//other code
}
安装
安装此扩展的首选方式是通过composer。
运行以下命令
php composer.phar require --prefer-dist fenghuilee/yii2-smartyviewer "*"
或添加
"fenghuilee/yii2-smartyviewer": "*"
到您的composer.json文件的require部分。
注意,smarty composer包使用subversion进行分发,因此您可能需要安装subversion。