HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //opt/cpanel/ea-php54/root/usr/share/tests/pear/HTML_Template_Flexy/tests/templates/looping.html

<h2>Looping</h2>


<p>a loop {foreach:loop,a} {a} {end:}</p>
<p>a loop with 2 vars {foreach:loop,a,b} 
    {a} , 
    {b}
{end:}</p>

Bug #84
{foreach:list,i}
  {method(i)}
{end:}

{foreach:list,i,j}
    {i}:{j}
{end:}

<table>
    <tr flexy:foreach="xyz,abcd,def">
        <td>{abcd}, {test(def)}</td>
    </tr>
</table>


<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
  <tr flexy:foreach="loop,a,b"> 
    <td>{a}</td>
    <td>{b}</td>
  </tr>
</table>

<h2>HTML tags example using foreach=&quot;loop,a&quot; or the tr using a highlight class.</h2>
<table width="100%" border="0">
  <tr flexy:foreach="loop,a" class="{a.hightlight}"> 
    <td>a is</td>
    <td flexy:if="a.showtext">{a.text}</td>
    <td flexy:if="!a.showtext">{a.price:n}</td>
  </tr>
</table>

<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
  <tr flexy:foreach="loop,a,b"> 
    <td flexy:foreach="b,c,d">{d}</td>
  </tr>
</table>

<h2>Looping in CDATA</h2>
Dont forget that php strips line breaks!
<![CDATA[
{foreach:list,i,j}
    {i}:{j}
    
{end:}
]]>