Smarty
来源:互联网 发布:刘轩豪网络 诈骗 编辑:程序博客网 时间:2024/05/16 11:38
Smarty的安装
安装类似于ecshop。
只需要将libs文件夹拷贝到服务器目录下即可。
templates:存放页面模板,路径任意。
templates_c:存放编译之后的页面模板。(在后台数据部发生变化时,打开网站调用的是编译之后的模板。里面的文件系统自动生成)
configs:模板所需要的特殊的配置文件
cache:存放Smarty缓存内的模板(临时)
应用Smarty
1.引入Smarty.class.php的文件
2.创建Smarty对象
3.更改模板存放路径及编译路径(templates_dir compile_dir)
4.修改界定符(left_delimiter right_delimiter)
5.编写模板(*.tpl(就是html))里面的数据部分用Smarty变量表示
6.在php文件中用assign方法给模板中的变量赋值
7.在php文件中用display方法将模板及数据显示。
模板注释被*号包围,例如 {* this is a comment *}
配置文件中的变量需要通过用两个"#"或者是smarty的保留变量$smarty.config.来调用
配置文件的变量只有在它们被加载以后才能使用.{config_load file=”配置文件名” section = “局部变量”}
{$smarty}保留变量
页面请求变量](就是get,post,server,session等变量)
<{$smarty.cookies.name}>
<{$smarty.session.name}>
<{$smarty.get.id}>
<{$smarty.post.name}>
{$smarty.now}
<{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}>
<{$smarty.config.edit}>
<{$smarty.foreach.a1.total}>
<{$smarty.section.a1.index}>- Smarty
- Smarty
- smarty
- smarty
- Smarty
- smarty
- smarty
- smarty
- smarty
- smarty
- smarty、
- smarty
- smarty
- Smarty
- Smarty
- smarty
- Smarty
- smarty
- 解释smarty的程序
- Smarty简明教程
- smarty中的 判断 循环 与常见问题
- UDA1341 driver enabling
- grep的用法
- Smarty
- 数据仓库和数据挖掘方面比较好的书籍
- struts2框架中,radio类型的input标签,如何传值?
- 你打算什么时候从重复中惊醒
- vc++获取系统时间
- 以前实习期间写的一段mfc编程,对数据库和xml格式文档的相关操作 主要相关代码 之三 导出数据库数据为xml格式自定义
- 全局变量和文件的读取
- 亲,淘宝数字产品业务部诚邀您加入
- 以前实习期间写的一段mfc编程,对数据库和xml格式文档的相关操作 主要相关代码 之四 读取xml格式文档到界面