TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

subblock and MergeField

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

By: Peter
Date: 2015-10-12
Time: 08:55

subblock and MergeField

Hello,
is a subblock with MergeField possible?

The Array:
$data=array('title=>'TEST',
'slides=>array('abc.jpg',cdef.jpg)
);

The Template:
<h1>[site.title;sub1=(slides)] <h1>

            <p>[site_sub1.val;block=p]</p>

I don't get it working...

Thanks for your help
Peter
By: Skrol29
Date: 2015-10-12
Time: 10:56

Re: subblock and MergeField

Hello,

parameters "sub1", "sub2", ... and parameter "block" work only for blocks. That is when you use MergeBlock().

You can use MergeBlock() with your snippet, but you have to turn your data record into a record set.
$data = array(
   array('title=>'TEST', 'slides'=>array('abc.jpg',cdef.jpg)),
);