zoujingli / think-smarty
ThinkPHP5 Smarty Template Driver
Installs: 1 050
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 5
Open Issues: 0
Requires
- php: >=5.4.0
- smarty/smarty: ^3.1
README
think-smarty
ThinkPHP5.0 Smarty 引擎驱动
目前只支持ThinkPHP5.0
仔细查看!
安装方法
使用composer安装模版引擎方法: composer require zoujingli/think-smarty
ThinkPHP5 配置文件中template
参数
[
// 模板引擎类型,指定为'Smarty'
'type' => 'Smarty',
// 模板路径,默认为当前模块下的`view`目录
'view_path' => '',
// 模板后缀
'view_suffix' => 'tpl',
// 模板文件名分隔符
'view_depr' => '.',
// 模板引擎普通标签开始标记
'tpl_begin' => '<{',
// 模板引擎普通标签结束标记
'tpl_end' => '}>',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
],
那么在控制器 index/index::index
中 return view();
时会加载模板 index/view/index.index.tpl
模板常量定义
[
'__ROOT__' => 'http://localhost/service/public',
'__SELF__' => 'http://localhost/service/public/index.php/index/index.html?id=1&name=3',
'__APP__' => 'http://localhost/service/public/index.php',
'__LIB__' => 'http://localhost/service/public/static/plugs',
'__STATIC__' => 'http://localhost/service/public/static',
'__UPLOAD__' => 'http://localhost/service/public/static/upload',
]