2016-04-19 13 views
-1

私はスマートな配列に値をつけて、私のスマートな配列を取り除くPHPスクリプトを持っています。私は1つの行に2つの列を印刷し、別の行を開始したい。Smartyテンプレート:すべての反復で2列を印刷

{section name=customer loop=$custid} 

    <tr> 

    // would love to start another loop here which will loop two times 
    <td>$custid<td> 

    // and end loop here 

    </tr> 

    {/section} 
+0

http://www.smarty.net/docs/en/ language.function.for.tpl – Chris

+0

クリス私はそれを見ましたが、実際には私が探しているものではありません – Thembi

+0

あなたが探しているものをより詳しく説明できますか?あなたは、2回実行されるループが必要だと言った。それはまさに 'のためのもの'です。 – Chris

答えて

0

あなたは、現在のループインデックスとMOD演算子を使用することができ、このようなものは(テストしていません)、おそらく動作します:

{section name=customer loop=$custid} 
    {assign var="column" value=$smarty.section.customer.index%2} 

    {if $column==0}<tr>{/if} 
    <td>$custid<td> 
    {if $column==1 || $smarty.section.customer.last}</tr>{/if} 
{/section} 
関連する問題