smarty内建函数简介
来源:互联网 发布:淘宝卖家代销流程图 编辑:程序博客网 时间:2024/05/17 03:32
内建函数
按照smarty的要求去用
config_load :加载配置文件
file= “配置文件名称”
section=“区域名称”
$tpl->configs=”./configs” //基准路径
./configs/dir_1/a.conf
<{config_load file=” dir_1/a.conf” section=“one” }>
include :
标签用于在当前模板中包含其它子模板.
当前模板中的变量在被包含的子模板中可用
<{include file=”header.tpl”}>
<{include file=”footer.html”}>
capture
捕获模板输出的数据并将其存储到一个变量里,而不是把它们输出到页面.
任何在 {capture name="foo"}和{/capture}之间的数据将被存储到变量$foo中,该变量由name属性指定.
在模板中通过 $smarty.capture.foo 访问该变量.
如果没有指定 name 属性,函数默认将使用 "default" 作为参数.
{capture}必须成对出现,即以{/capture}作为结尾,该函数不能嵌套使用.
<{capture name=”自定义区域名”}>
aAaaaaaaaaaaaaa
<{$name}>
<{include file=”head.tpl”}>
……
<{/capture}>
<{$smarty.capture.自定义区域名}>
foreach,foreachelse
功能和语法与php当中类似,====foreach
foreach($row as $key=>$value){
…
}
效率差;
for($i=0;$i<5;$i++){ }
变量
$smarty.foreach.循环名.变量名
iteration :用于显示当前循环的执行次数,从1开始,每执行一次增加 1
first :
last
show
total
section,sectionelse (推荐)for
功能和效率要比foreach好
只针对索引数组
section 显示二维数组 loop
section 不能处理下标不连续的数组
if,elseif,else
strip
include_php
insert
php
ldelim,rdelim
literal- smarty内建函数简介
- smarty内建函数
- smarty 内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- SMARTY内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- smarty内建函数
- Smarty内建函数
- Smarty内建函数
- smarty的内建函数
- PHP开发工具Zend Studio下载地址汇总
- Azure Basic - Pricing
- 实现添加附加并上传功能的笔记
- add yum source for ffmpeg
- 将文件加入 eclipse java工程
- smarty内建函数简介
- linux 音频编程咋这么烦啊
- python使用crontab执行hadoop相关任务
- DataGridView取消默认选中行
- JQuery 学习笔记
- Window iframe
- 验证邮箱是否真实存在 c#
- 非常值得看的一篇文章—HP大中华区总裁孙振耀退休感言
- smarty与php缓存的操作