配置文件
来源:互联网 发布:cc攻击 php网站防御 编辑:程序博客网 时间:2024/06/08 10:07
1、配置文件有利于设计者管理文件中的模板全局变量
2、配置文件是通过内建函数载入到模板中 <{ config_load file="文件地址" }>
foo.conf: //#注释部分
pageTitle = "This is mine" //当变量中有空格时,需要用引号引着,没有空格时 ,可不引 。" " " 是定界符,定界符中可以是任意格式
bodyBgColor = "#eeeeee"
tableBorderSize = "3"
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"
[mycolor] // [ ]是section的内容 当写section时,需顶格写
bgcolor = #000000
index.tpl:
{config_load file="foo.conf" section='mycolor'}
<html>
<title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}">
<td>First</td><td>Last</td><td>Address</td>
</tr>
</table>
</body>
</html>
index.tpl:
{config_load file="foo.conf"}
<html>
<title>{$smarty.config.pageTitle}</title>
<body bgcolor="{$smarty.config.bodyBgColor}">
<table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}">
<tr bgcolor="{$smarty.config.rowBgColor}"
<td>First</td><td>Last</td><td>Address</td>
</tr>
</table>
</body>
</html>
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- 配置文件
- C++:20129060
- 中文乱码解决
- git,刚学,记几个用法
- 设计器打不开
- Sql Server使用事务实现--转账问题
- 配置文件
- 最长单增子序列
- Linux iptables配置以及用法
- Smarty配置文件内置变量
- smarty的有关配置文件
- Ubuntu10.04下Linux内核编译的完整步骤
- 多线程一
- 创建及删除管理员用户(3种数据库)
- 使用系统存储过程 及 自定义存储过程 “usp_Helloworld”