title: Foreach in table...limit to 7 then create new row
body: <p>I have this code printing the output of a list of best selling products.  The problem is it spans horizontally without breaking and goes off the side of the screen after 7 products.</p>
  
  <p>What I'd like to do, and am completely stymied as my attempts have been fruitless, is to have the 8th to 14th entries start a new row.  How do I need to modify my code in order to accomplish this?</p>
  
  <pre><code>&lt;?php $products = $this-&gt;getCollection(); ?&gt;
  &lt;?php if ($products &amp;&amp; $products-&gt;count() &gt; 0) { ?&gt;
  
  &lt;div class="block block-list block-viewed"&gt;
      &lt;div class="block-title"&gt;
          &lt;strong&gt;&lt;span&gt;&lt;?php echo $this-&gt;__($this-&gt;getHeader()) ?&gt;&lt;/span&gt;&lt;/strong&gt;
      &lt;/div&gt;
      &lt;div class="block-content"&gt;
  
      &lt;table class="amsorting-table"&gt;
          &lt;tr&gt;
          &lt;?php foreach ($products as $p) { ?&gt;
              &lt;td style="padding: 15px 15px 0px 15px;"&gt;
                  &lt;a href="&lt;?php echo $p-&gt;getProductUrl() ?&gt;" title="&lt;?php echo $this-&gt;htmlEscape($p-&gt;getName()) ?&gt;" class="product-image"&gt;&lt;img 
  src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($p, 'small_image')-&gt;resize(125) ?&gt;" width="125" height="125" alt="&lt;?php echo 
  $this-&gt;htmlEscape($p-&gt;getName()) ?&gt;" /&gt;&lt;/a&gt;
                  &lt;h3 class="product-name"&gt;&lt;a href="&lt;?php echo $p-&gt;getProductUrl() ?&gt;" title="&lt;?php echo $this-&gt;htmlEscape($p-&gt;getName()) 
  ?&gt;"&gt;&lt;?php echo $this-&gt;htmlEscape($p-&gt;getName()) ?&gt;&lt;/a&gt;&lt;/h3&gt;
                  &lt;?php echo $this-&gt;getPriceHtml($p, true) ?&gt;
  
              &lt;/td&gt;
          &lt;?php } ?&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;?php foreach ($products as $p) { ?&gt;
                 &lt;td style="padding: 0px 15px 15px;"&gt;
                  &lt;?php if($p-&gt;isSaleable()): ?&gt;
                          &lt;button type="button" title="&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;" class="button btn-cart"
  onclick="setLocation('&lt;?php echo $this-&gt;getAddToCartUrl($p) ?&gt;')"&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Add to Cart')
  ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;
                      &lt;?php else: ?&gt;
                          &lt;p class="availability out-of-stock"&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Out of stock') ?&gt;&lt;/span&gt;&lt;/p&gt;
                      &lt;?php endif; ?&gt;
  
              &lt;?php } ?&gt;
                &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;?php } ?&gt;
  </code></pre>