Categories > OpenTBS with DOCX >

nested pages

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: gmaui
Date: 2014-08-06
Time: 15:09

nested pages

Hi
I am using OpenTBS since a few months and it is really a great tool for document creation. Now I am trying to implement the following feature with little success :

My data is :
$product[0] = array('title' => "product 1", "color" => "red", "form" => "circle");
$product[1] = array('title' => "product 2", "color" => "green", "form" => "cube");
$product[2] = array('title' => "product 3", "color" => "blue", "form" => "line");
$product[3] = array('title' => "product 4", "color" => "yellow", "form" => "arc");
and more

and I want to split product data on several pages on the same document : the first page for the title, the others page for 'data' fields. Example :
Start page
  product is "product 1"
End page
Start page
  product form is "circle"
End page
Start page
  product color is "red"
End page
Start page
  product is "product 2"
End page
Start page
  product form is "cube"
End page
Start page
  product color is "green"
End page
Start page
  product is "product 3"
End page
Start page
  product form is "line"
End page
Start page
  product color is "blue"
End page
Start page
  product is "product 4"
End page
Start page
  product form is "arc"
End page
Start page
  product color is "yellow"
End page
and more

My template is :
<page break>[product.title;block=tbs:page]
<page break>[product.form;block=tbs:page]
<page break>[product.color;block=tbs:page]
where <page break> is where I inserted a new page break

My php script is :
$TBS->MergeBlock('product', $product);

I get the unexpected result :
Start page
  product is "product one"
End page
Start page
  product form is "cube"
End page
Start page
  product color  is "blue"
End page
Start page
  product is "product two"
End page

I will appreciate any help on what i am missing on page block.
Regards
giuseppe

By: Skrol29
Date: 2014-08-10
Time: 22:13

Re: nested pages

Hi Hiuseppe,

Your template should be:
<page break>[product.title;block=tbs:page+tbs:page+tbs:page]
<page break>[product.form]
<page break>[product.color]

What you've defined previously are sections of blocks.
See http://www.tinybutstrong.com/manual.php#html_block_section
By: gmaui
Date: 2014-08-28
Time: 14:06

Re: nested pages

Hi Skrol29

thanks for pointing me extended blocks. It works.

What is your idea if dealing with dynamic number of pages ?
Assume I get from a database a different number of attributes for each products in the following structure :
$product[0] = array('title' => "product 1", 'attributes' = array("attr1", "attr2", "attr3",..., "attrN"));
$product[1] = array('title' => "product 2", 'attributes' = array("attr1", "attr2",..., "attrM"));
Is there a way to insert a <page break> manually during the merge in order to get |product 1|attr1|attr2| ... |attrN|product 2|attr1|attr2|...|attrM| ? "|..|" is a page.

Thanks for your consideration.
By: Skrol29
Date: 2014-08-28
Time: 23:44

Re: nested pages

You cannot predict the height of a display text in Ms Word.

But you can probably use the "Kepp with next" property of paragraphs in Ms Word in order the compose a set of paragraphs that stay together on the same page (it possible).