在Yii中整合Smarty
来源:互联网 发布:积分兑换软件 编辑:程序博客网 时间:2024/06/06 00:38
本文介绍Yii如何整合Smarty。
虽然说Yii的viewhelper已经够强大,CHtml,Jui..等等,甚至可以灵活的扩展这些组件,整合Smarty确实有点舍近求远。但是萝卜白菜,各有所爱,Yii灵活的扩展性,即插即用的Components,very gelivable..!也算抛砖引玉,整合其他第三方类库也是如此。
首先在protected中新建vendor文件夹或自定义的目录中放入我们的smarty类包,我这里是用vendor。
按照约定我们同在protected下的extensions(Yii的扩展默认都扔到这里)中建立CSmarty类文件。
内容如下:
file:webapp/protected/extensions/CSmarty.php
<?php
require_once(Yii::getPathOfAlias('application.vendor.smarty').DIRECTORY_SEPARATOR.'Smarty.class.php');
define('SMARTY_VIEW_DIR',Yii::getPathOfAlias('application.views.smarty'));
class CSmarty extends Smarty {
}
?>
然后建立相关联的文件夹。
最后是我们的配置部分
打开protected/config/main.php
在components数组中加入
'smarty'=>array(
),
action:
Yii::app()->smarty;
如此就会得到smarty的实例了 : )
- 在Yii中整合Smarty
- yii整合smarty
- 在YII框架中运用smarty模板引擎
- PHP Yii框架中使用smarty模板
- 在Smarty中使用FCKeditor
- 在smarty中自定义函数
- Yii使用smarty模板
- Yii整合ZF2中Feed模块
- 在yii中使用memcache
- 在yii中使用memcache
- 在yii中使用分页
- 在smarty中通过php脚本获取smarty变量
- 在smarty中通过php脚本给smarty赋值
- Ecshop在模板中$smarty session cookie等调用$smarty.session $smarty.cookie
- Smarty 显示大括号 | 在Smarty中计算数组元素的长度 | Smarty字符串拼接
- Ecshop在模板中$smarty session cookie等调用$smarty.session $smarty.cookie
- Ecshop在模板中$smarty session cookie等调用$smarty.session $smarty.cookie
- Ecshop在模板中$smarty session cookie等调用$smarty.session $smarty.cookie
- SQLServer数据库创建索引
- apue(9)
- UISplitViewController 只能用在最开始的 window.rootViewController
- 一个工程引用其它工程
- QT 多线程程序设计
- 在Yii中整合Smarty
- SQL查询速度慢的原因分析和解决方案
- 13球3次称重问题
- js获取当前Url网址路径及参数 location.hostname
- WebSphere MQ error (893) has occurred. 的问题
- 图像特征特点及其常用的特征提取与匹配方法
- XML找不到节点的原因
- ArcGIS中的几何对象—— Geometry
- HDOJ 1018 Big Number