Categories > TinyButStrong general >

Serial sub-blocks

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Rebus
Date: 2005-11-10
Time: 19:49

Serial sub-blocks

I'm trying to use serial with sub-blocks:

$TBS->MergeBlock('main','adodb',"SELECT * from category ORDER BY id");
$TBS->MergeBlock('sub','adodb',"SELECT prod_name FROM product WHERE category='%p1%' ORDER BY RAND() LIMIT 4");

I can get the sub-block to display in a single column:
<table>
  <tr>
    <td style="font-weight:bold">[main.cat_name;block=table]</td>
  </tr>
  <tr>
    <td>[sub.prod_name;block=tr;p1=[main.cat_name]]</td>
  </tr>
</table>
But I can't get it to work with serial:
<table>
  <tr>
    <td colspan="4" style="font-weight:bold">[main.cat_name;block=table]</td>
  </tr>
  <tr>
    <td>[sub;block=tr;serial][sub_1.prod_name;block=td;p1=[main.cat_name]]</td>
    <td>[sub_2.prod_name;block=td;p1=[main.cat_name]]</td>
    <td>[sub_3.prod_name;block=td;p1=[main.cat_name]]</td>
    <td>[sub_4.prod_name;block=td;p1=[main.cat_name]]</td>
  </tr>
</table>
How can I display the sub-block in four columns instead of one?
By: Skrol29
Date: 2005-11-11
Time: 16:04

Re: Serial sub-blocks

This is because parameter "p1" should be in the first tag definition.
Like this:
<table>
  <tr>
    <td colspan="4" style="font-weight:bold">[main.cat_name;block=table]</td>
  </tr>
  <tr>
    <td>[sub;block=tr;serial;p1=[main.cat_name]]
           [sub_1.prod_name;block=td]</td>
    <td>[sub_2.prod_name;block=td]</td>
    <td>[sub_3.prod_name;block=td]</td>
    <td>[sub_4.prod_name;block=td]</td>
  </tr>
</table>
By: Rebus
Date: 2005-11-11
Time: 17:35

Re: Serial sub-blocks

Thanks Skrol, it works fine now.