?
This document uses PHP Chinese website manual Release
Attribute Name | Type | Required | Default | Description |
---|---|---|---|---|
name | string | No | default | The name of the cycle |
values | mixed | Yes | N/A | The values to cycle through, either a comma delimited list (see delimiter attribute), or an array of values. |
boolean | No | true | Whether to print the value or not | |
advance | boolean | No | true | Whether or not to advance to the next value |
delimiter | string | No | , | The delimiter to use in the values attribute. |
assign | string | No | n/a | the template variable the output will be assigned to |
屬性 | 類型 | 是否必須 | 缺省值 | 描述 |
---|---|---|---|---|
name | string | No | default | 輪轉(zhuǎn)的名稱 |
values | mixed | Yes | N/A | 待輪轉(zhuǎn)的值,可以是用逗號(hào)分隔的列表(請(qǐng)查看 delimiter 屬性)或一個(gè)包含多值的數(shù)組. |
boolean | No | true | 是否輸出值 | |
advance | boolean | No | true | 是否使用下一個(gè)值(為 false 時(shí)使用當(dāng)前值) |
delimiter | string | No | , | 指出values 屬性中使用的分隔符,默認(rèn)是逗號(hào). |
assign | string | No | n/a | 輸出值將被賦給模板變量的名稱 |
Cycle is used to cycle though a set of values. This makes it easy to alternate between two or more colors in a table, or cycle through an array of values.
Cycle 用于輪轉(zhuǎn)使用一組值. 該特性使得在表格中交替輸出顏色或輪轉(zhuǎn)使用數(shù)組中的值變得很容易.
You can cycle through more than one set of values in your template by supplying a name attribute. Give each set of values a unique name.
如果需要在模板中使用多個(gè)輪轉(zhuǎn),需要給出唯一的 name 屬性.
You can force the current value not to print with the print attribute set to false. This would be useful for silently skipping a value.
用戶可以設(shè)置 print 屬性為 false 強(qiáng)制不輸出當(dāng)前值. 該特性可以很方便地略過某個(gè)值.
The advance attribute is used to repeat a value. When set to false, the next call to cycle will print the same value.
advance 屬性用于重復(fù)使用某個(gè)值. 當(dāng)該屬性設(shè)置為 false 時(shí),下次調(diào)用該輪轉(zhuǎn)時(shí)將輸出同樣的值.
If you supply the special "assign" attribute, the output of the cycle function will be assigned to this template variable instead of being output to the template.
如果指定了 "assign" 這個(gè)特殊屬性,該輪轉(zhuǎn)的輸出值將被賦給由 assign 指定的模板變量,而不是直接輸出.
Example 8-3. cycle
|