TinyButStrong - the PHP Template Engine
Categories > Your tips & tricks >

How to merge several blocks having the same name

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

By: Skrol29
Date: 2009-09-23
Time: 11:44

How to merge several blocks having the same name

This tip has been added to the manual on 2009-09-23.

You cannot merge several blocks having the same names because they are considered by TBS has a one and only block composed of several sections.
Nevertheless, you can use a tip to get a similar behavior. If you use parameter p1 without value in the block definition, that does forces TBS to consider the section as a new block break, like it does for subblocks.

Example:
<table>
  <tr><td> [b.id;block=tr;p1] </td><td> [b.name] </td>
</table>

<table>
  <tr><td> [b.id;block=tr;p1] </td><td> [b.name] </td>
</table>

PHP:
$TBS->MergeBlock('b','mysql','SELECT * FROM MyTable');

Versioning: this tip is available since TBS version 3.4.