counter

PHP Smarty

Smarty - the compiling PHP template engine
Smarty - php 模板编译引擎
Prev 来源:PHP中文社区 Chapter 8. Custom Functions[第八章.自定义函数] Next

counter

Attribute Name Type Required Default Description
name string No default The name of the counter
start number No 1 The initial number to start counting from
skip number No 1 The interval to count by
direction string No up the direction to count (up/down)
print boolean No true Whether or not to print the value
assign string No n/a the template variable the output will be assigned to

属性 类型 是否必须 缺省值 描述
name string No default 计数器的名称
start number No 1 记数器初始值
skip number No 1 记数器间隔、步长
direction string No up 记数器方向,(增/减)
print boolean No true 是否输出值
assign string No n/a 输出值将被赋给模板变量的名称
{* initialize the count *}
{counter start=0 skip=2 print=false}

{counter}<br>
{counter}<br>
{counter}<br>
{counter}<br>

OUTPUT:

2<br>
4<br>
6<br>
8<br>

Prev 来源:PHP中文社区 Home Next
Custom Functions Up cycle