PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

cycle | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

cycle

Attribute NameTypeRequiredDefaultDescription
namestringNodefaultThe name of the cycle
valuesmixedYesN/AThe values to cycle through, either a comma delimited list (see delimiter attribute), or an array of values.
printbooleanNotrueWhether to print the value or not
advancebooleanNotrueWhether or not to advance to the next value
delimiterstringNo,The delimiter to use in the values attribute.
assignstringNon/athe template variable the output will be assigned to

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.

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.

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.

The advance attribute is used to repeat a value. When set to true, the next call to cycle will print the same value.

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.

Example 8-3. cycle

{section name=rows loop=$data}
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
   <td>{$data[rows]}</td>
</tr>
{/section}

OUTPUT:

<tr bgcolor="#eeeeee">
   <td>1</td>
</tr>
<tr bgcolor="#d0d0d0">
   <td>2</td>
</tr>
<tr bgcolor="#eeeeee">
   <td>3</td>
</tr>
忘却曲線を使ってこの関数を確実に記憶に残す

フォーラムで「cycle」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | cycle」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: