Categories > TinyButStrong general >

an array in tbs_include.onload...

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: fray
Date: 2003-10-06
Time: 14:53

an array in tbs_include.onload...

I need to include several (an unspecified number of) file in a block

It seems not possible to repeat a file inclusion in a block by passing an array

the code:
<div class="rigthBlock">
    [tbs_include.onload;file=[var.rtBlk];block=div]
</div>               

returns "TinyButStrong Error (LoadFile): error when opening the file 'Array'"


<div class="rigthBlock">
    [tbs_include.onload;file=[slots.rtBlk];block=div]
</div>               

...
$TBS->MergeBlock("slots",array_rtBlk);

returns "TinyButStrong Error (LoadFile): error when opening the file '[slots.rtBlk]'"


thanks!
By: Skrol29
Date: 2003-10-06
Time: 15:08

Re: an array in tbs_include.onload...

hi Fray,

You're piece of template can't work because the [tbs_include] tag is not for a block.

This should work:
<div class="rigthBlock">
    [slots.val;file=[val];block=div]
</div>
...
$TBS->MergeBlock("slots",$array_rtBlk);

$array_rtBlk should be a usual PHP array containing the files names (and evenually paths) as values.
- "slots.val" is the syntax to point on the value of Php Array for a merge-field.
- "file=[val]" enables you to include a file using the value of the field as the name of the file.

Enjoy,
By: fray
Date: 2003-10-06
Time: 15:36

Re: an array in tbs_include.onload...

It works!!

I thought the key "tbs_include" was mandatory for inclusion...
but now I have understood

Thank you!
and thanks for your great work!