TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Using Subblocks with an existing Templatefile?

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

By: Timo
Date: 2013-12-03
Time: 10:00

Using Subblocks with an existing Templatefile?

Hello,

i'm a newbie in using TBS and an i have encountered an problem that the documentation coudn't solve for me.
We are using TBS in our statistic backend for various reports or parts of these reports. So we have an existing template for i.e. the shipping costs in an existing transport category and
an multidimensional Array that contains an array list of all products grouped by the transportation-method and the shipping report for these category.
but i coudn't use the pre existing "shipping"-templates because i cant get the subarray/subblock to work with the existing block-label "shipping".

I should avoid to alter the looping or creation process of the array. something i would normal do - simply merge the block for shipping in an loop.
so i've have to merge the block in the template ....kind of.

Array-Structure:
    $groupArticle[$key]['category']    = string
    $groupArticle[$key]['products']    = array( ..... )
    $groupArticle[$key]['shipping']    = array( ..... )

Template:
<tr class="[shipping.#;ope=mod:2;if [val]=0;then 'even';else 'odd';]">
    <td align="left">[shipping.amount;block=tr;htmlconv=no;]</td>
    <td align="left">[shipping.type;block=tr;htmlconv=no;]</td>
    <td align="right">[shipping.handling;block=tr;frm='0.000,00'] &euro;</td>
    <td align="right">[shipping.cont_price;block=tr;frm='0.000,00'] &euro;</td>
</tr>

Has anyone an idea how to solve this and avoid to copying the template and rename the block?
By: Skrol29
Date: 2013-12-13
Time: 02:41

Re: Using Subblocks with an existing Templatefile?

Hi Timo,

Is your problem solved?

I'm not sure to understand quite well. Is the snippet comes from another template and you're trying to use it the current one ?

Did you have look at parameter "rename"?