?
? ????? PHP ??? ???? ??? ?? ??
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 | 輪轉的名稱 |
values | mixed | Yes | N/A | 待輪轉的值,可以是用逗號分隔的列表(請查看 delimiter 屬性)或一個包含多值的數組. |
boolean | No | true | 是否輸出值 | |
advance | boolean | No | true | 是否使用下一個值(為 false 時使用當前值) |
delimiter | string | No | , | 指出values 屬性中使用的分隔符,默認是逗號. |
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 用于輪轉使用一組值. 該特性使得在表格中交替輸出顏色或輪轉使用數組中的值變得很容易.
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.
如果需要在模板中使用多個輪轉,需要給出唯一的 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.
用戶可以設置 print 屬性為 false 強制不輸出當前值. 該特性可以很方便地略過某個值.
The advance attribute is used to repeat a value. When set to false, the next call to cycle will print the same value.
advance 屬性用于重復使用某個值. 當該屬性設置為 false 時,下次調用該輪轉時將輸出同樣的值.
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" 這個特殊屬性,該輪轉的輸出值將被賦給由 assign 指定的模板變量,而不是直接輸出.
Example 8-3. cycle
|