Search code examples
phpopentbstinybutstrong

Dynamic paragraphs with openTBS - strange behaviour


That's an array I have:

array(2) { 
[0]=> array(4) { ["theme"]=> string(9) "тема2" ["description"]=> string(9) "опис2" ["literature_main"]=> string(7) "літ2" ["litarature_add"]=> string(7) "доп2" } 
[1]=> array(4) { ["theme"]=> string(9) "тема1" ["description"]=> string(9) "опис1" ["literature_main"]=> string(7) "літ1" ["litarature_add"]=> string(7) "доп1" } }

I'm trying to display it dynamically in .docx with the following template:

Theme: [item.theme;block=tbs:p]
Des: [item.description;block=tbs:p]
Lit1: [item.literature_main;block=tbs:p]
Lit2.: [item.litarature_add;block=tbs:p]

What I'm getting is just a mix of those two without des, lit1, lit2 even being displayed.

Basically, I get mess. And it seems like it's completely random process, cause if i remove all but theme[item.theme;block=tbs:p] then I get two paragraphs in word. I would really appreciate any help.


Solution

  • With TinyButStrong, each section of block (defined with block=tbs:p) is considered as an alternative section.

    So, assuming each line in your snipped is a paragraph, your block definition should be :

    Theme: [item.theme;block=4*tbs:p]
    Des: [item.description]
    Lit1: [item.literature_main]
    Lit2.: [item.litarature_add]