Smarty的一些基本知识点

来源:http://www.phpchina.com/48021/viewspace_17803.html
Smarty保留变量:
{$smarty.*}可以访问页面请求变量诸如get,post,cookies,server,enviroment和session变量
{$smarty.now}变量用于访问 当前时间戳.
{$smarty.const._MY_CONST_VAL}访问php常量
{$smarty.capture}访问{capture}{/capture}截取的输出
{$smarty.config}问已经加载的config变量
{$smarty.section}, {$smarty.foreach}访问'section'和'foreach'循环的属性
{$smarty.template}这个变量包含了当前被处理的模板的名字.
Smarty内建函数:
capture                                缓存块
config_load                        加载配置文件
foreach,foreachelse         遍历数组
include                                包含普通文件
字串5

include_php                       包含PHP脚本
insert                                   插入一个函数执行的结果
if,elseif,else                       IF语句
ldelim,rdelim                     Smarty的左/右限定符
literal                                   说明一个字符串块(可以把Javascrīpt包含在块中)
php                                      说明一个PHP脚本块 字串7
section,sectionelse         复杂的循环(类似for循环)
    参数:
       name  
       loop
       start
       step
       max
       show
    section内部或外部可用属性:
       index                  当前循环的记数下标
       index_prev        当前循环的前一个下标
       index_next        当前循环后一个下标
       iteration             当前循环的行号
       first                     是否为循环的开始 字串1
       last                     是否为循环的结束
       rownum             iteration的别名
       loop                    循环结束后,最后一个index值
       show                  section参数。决定是否显示循环结果
       total                    循环总次数
       strip                    过滤掉块中的空格等多余HTML...
字串7

常规函数:
assign                           给某个变量赋值
counter                          计数器
cycle                               可以用来控制<tr>与<tr>之间的不同颜色
debug    
eval
fetch                                 可以fetch一个文件,用file参数指定
html_checkboxes          构造checkbox
html_image                    构造image

字串9


html_options                  构造select的option选项
html_radios                    构造radio
html_select_date          构造一个日期选择select
html_select_time          构造一个时间选择select
html_table                      构造一个table,构造时可以向table中加入数据
math                                为了在模版中能够计算一个表达式的值
mailto                              构造一个E-Mail连接.可以选择多个参数 字串2
popup_init                      初始化popup使用JS(就是包含处理popup的JS文件)
popup                              构造一个弹出窗口.有丰富的参数控制
textformat                        将textformat块按照制定的参数格式化
posted @ 2008-03-06 15:58  harry.guo  阅读(372)  评论(0编辑  收藏  举报