
Yii使用smarty模板
发布日期:2021-05-10 09:42:08
浏览次数:12
分类:精选文章
本文共 2099 字,大约阅读时间需要 6 分钟。
���Yii���������������Smarty������������
���������Yii���������������������Smarty���������������������������������������������������������������������
������Smarty������������
���Smarty���������������������������protected/extensions
���������������������������������������������������application/extensions/smarty
���������CSmarty���������
���application/extensions/smarty
������������������������������������������CSmarty.php
������������������template_dir = SMARTY_VIEW_DIR; $this->compile_dir = SMARTY_VIEW_DIR . self::DIR_SEP . 'template_c'; $this->caching = true; $this->cache_dir = SMARTY_VIEW_DIR . self::DIR_SEP . 'cache'; $this->left_delimiter = ' '; $this->cache_lifetime = 3600; } public function init() {}}
- ������Yii������������
protected/config/main.php
������������components
���������������Smarty��������� - ������������������������Smarty���������������Smarty���������������������������������������
- ������Smarty���������������������smarty���������Action���������������������������������
- ������������
- ������
views
������������template_c
���cache
���������������������������������������������mkdir -p application/views/template_cmkdir -p application/views/cache
- Smarty���
cache_lifetime
������������������������������������������������ - ���������������������������������������������Smarty���������������������������������������������������������������������
- ������
'smarty' => array( 'class' => 'application.extensions.CSmarty',),
public $smarty = '';public function init() { if (!empty($this->smarty)) { $this->smarty = Yii::app()->smarty; } else { $this->smarty = new CSmarty(); // ���������Smarty��������������������������������������������������� $this->smarty->caching = true; $this->smarty->cache_lifetime = 3600; }}
public function actionSomeAction() { $this->smarty->display('your_template_name.htm'); // ���������getBlockStarted���getBlockEnded������������������������������������}
������������������������������������������Yii������������������������Smarty������������������������������������
发表评论
最新留言
表示我来过!
[***.240.166.169]2025年04月28日 08时38分42秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
Unknown database ‘modd‘
2021-05-10
重载和重写的区别:
2021-05-10
finally,final,finalize() 的区别
2021-05-10
js的三种输出方式
2021-05-10
#{}和${}的区别是什么
2021-05-10
nginx服务器访问404
2021-05-10
搭建Vue项目步骤
2021-05-10
Springboot项目打包
2021-05-10
docker镜像命令
2021-05-10
docker容器命令
2021-05-10
idea右边maven窗口
2021-05-10
CentOS7使用keepalive实现nginx的高可用
2021-05-10
Centos7.4下mysql5.6开启ssl
2021-05-10
srvctl命令详解
2021-05-10
linux centos6.4 磁盘分区、格式化、挂载
2021-05-10
【CCNA】之配置DHCP
2021-05-10
mysql-5.7 innodb_buffer_pool刷新机制详解
2021-05-10