Categories > TinyButStrong general >

Serial blocks with blocks inside?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Ciarán
Date: 2006-04-13
Time: 12:21

Serial blocks with blocks inside?

Hi gang,

I'm trying to produce a calendar using TBS. I've managed to output the entire calendar but I want to show 4 months per row in a table, like

Jan Feb Mar Apr
May Jun Jul Aug
Sep Oct Nov Dec

So it seems to me this should be doable with the serial paramater but I can't get it to work. I thought perhaps something like this:

<!-- begin calendar display -->
<table align='center' style='width: auto' border=10>
<tr valign='top'>
  <td>[onload_cals;block=tr;serial][onload;file=tpl/cal_month.tpl;block=td]</td>
  <td>[onload_cals_2;file=tpl/cal_month.tpl;block=td]</td>
  <td>[onload_cals_3;file=tpl/cal_month.tpl;block=td]</td>
  <td>[onload_cals_4;file=tpl/cal_month.tpl;block=td]</td>
</tr>
</table>
<!-- end calendar display -->

But nothing displays.
In the cal_month.tpl I have another block (which I'm Merging from PHP) and a serial block inside that. I can post the code if it would help.

Can anyone see what I'm doing wrong?

Thanks!
By: Skrol29
Date: 2006-04-13
Time: 13:15

Re: Serial blocks with blocks inside?

Hi Ciarán,

Parameter "serial" doesn't work with automatic [onload] and [onshow] blocks because they are not merged with data. Such block shoud have a parameter "when" or "default".

Something like this could help:

HTML:
<table align='center' style='width: auto' border=10>
<tr valign='top'> [month;block=tr;serial]
  <td>
    [month_[col.val;block=td].name;block=td]
    [onload;file=tpl/cal_month.tpl]
  </td>
</tr>
</table>

PHP:
$TBS->MergeBlock('col','num',4);
$TBS->MergeBlock('month','num',12);
By: Ciarán
Date: 2006-04-13
Time: 13:55

Re: Serial blocks with blocks inside?

Ah, nice thinking.
I had to change my template a bit since the file I included had a block in it, so I had to change that block's name to month_[col.val] everywhere, and then Merge the month block with my array instead.

Works great now though, thanks a lot.