Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

Chapter 8. 自定义函数

Smarty自带了一些自定义的函数�件,�以在模�内使用。

{counter}

{counter}用于显示一个计数器。 {counter}�以记�foreach循环的次数。 你�以设置计数器的数值�步长�计算方�,和是��次显示数值。 你�以�时使用多个���的计数器。 如果没有指定计数器�称,那么“default�将是默认的�称。

如果你指定了assign属性,那么{counter} 的输出将被赋值给模���。

�数�称 类型 必选�数 默认值 说明
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 赋值的���

Example 8.1. {counter}


{* initialize the count *}
{counter start=0 skip=2}<br />
{counter}<br />
{counter}<br />
{counter}<br />

  

输出:


0<br />
2<br />
4<br />
6<br />

  

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 9 plus 18? (Are you human?)

Advertisement