TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Generating with serial and empty pictures

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Preben
Date: 2013-10-14
Time: 23:09

Generating with serial and empty pictures

I am trying to generate a m by 4 table with this html-template
  <table class="product">
      <td class="product"><a class="product" href="product.php?view&amp;id=[product_1.id]"><img class="product" src="product.php?image&amp;id=[product_1.image]" alt="[product_1.name;block=td]"><br />[product_1.name]</a></td>
      <td class="product"><a class="product" href="product.php?view&amp;id=[product_2.id]"><img class="product" src="product.php?image&amp;id=[product_2.image]" alt="[product_2.name;block=td]"><br />[product_2.name]</a></td>
      <td class="product"><a class="product" href="product.php?view&amp;id=[product_3.id]"><img class="product" src="product.php?image&amp;id=[product_3.image]" alt="[product_3.name;block=td]"><br />[product_3.name]</a></td>
      <td class="product"><a class="product" href="product.php?view&amp;id=[product_4.id]"><img class="product" src="product.php?image&amp;id=[product_4.image]" alt="[product_4.name;block=td]"><br />[product_4.name][product;block=tr;serial]</a></td>

and corresponding php
  $belts = $products->getProducts();

I am running into an issues, that whenever I have a number of products that does not divide by 4 with mod 0 then "empty" images are shown - which means that there is a border and a symbol showing that there should have been a picture. How do I solve this?

By: Skrol29
Date: 2013-10-15
Time: 02:07

Re: Generating with serial and empty pictures


You can use an extra <td> definition for empty cells with block "product_0".
This can be define in another row.
See the example here: http://tinybutstrong.com/examples.php?e=prmserial&m=template