title: Smarty using foreach
body: <pre><code>    {foreach from=$last_comments item=lastcomment name=myLoop}
  
          &lt;dt class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"&gt;&lt;a href="{$lastcomment.link}" title="{$lastcomment.name|escape:html:'UTF-8'}"&gt;{$lastcomment.name|strip_tags|escape:html:'UTF-8'|truncate:25:'...'}&lt;/a&gt;&lt;/dt&gt;
          &lt;dd class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"&gt;
              &lt;div class="star_content clearfix"&gt;
                  {section name="i" start=0 loop=5 step=1}
                      {if $lastcomment.grade le $smarty.section.i.index}
                          &lt;div class="star"&gt;&lt;/div&gt;
                      {else}
                          &lt;div class="star star_on"&gt;&lt;/div&gt;
                      {/if}
                  {/section}
              &lt;/div&gt;
              {if $display_title &amp;&amp; $lastcomment.title}{if $maxchar_title}{$lastcomment.title|escape:html:'UTF-8'|truncate:$maxchar_title:'...'}{else}{$lastcomment.title|escape:html:'UTF-8'}{/if}{elseif $display_title &amp;&amp; $display_notitle}{l s='No title'  mod='blocklastcomments'}{/if}&lt;p&gt;{if $maxchar_comment}{$lastcomment.content|escape:html:'UTF-8'|truncate:$maxchar_comment:'...'}{else}{$lastcomment.content|escape:html:'UTF-8'}{/if}&lt;/p&gt;&lt;span class="customer"&gt;{if $lastcomment.customer_name}({$lastcomment.customer_name|escape:html:'UTF-8'}.){/if}&lt;/span&gt;
          &lt;/dd&gt;
      {/foreach}
  </code></pre>
  
  <p>I would like to iterate through the $last_comments a fixed nr of times. How do I achieve this?</p>