Categories > OpenTBS with ODT >

Can't get to mergeblock succesfully with ODT document

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Rafael
Date: 2015-03-12
Time: 11:43

Can't get to mergeblock succesfully with ODT document

Hello

I have an array created with this values (this is a print_r result):

( [0] => Array ( [nombre] => AYUNTAMIENTO DE SAN PEDRO [nbop] => DESCOMENTAR  [date] => 7 de Marzo de 2006 [registro] => 1031/2006 [numero_recibo] => 0900001 [organismo] => JUZGADOS [asunto] => Notificación [date_abono] => 0 de de [importe] => 0,00 € [fecha_actual] => 12 de Marzo de 2015 ) [1] => Array ( [nombre] => AYUNTAMIENTO DE BB [nbop] => DESCOMENTAR  [date] => 8 de Marzo de 2006 [registro] => 1296/2006 [numero_recibo] => 0610001 [organismo] => AYUNTAMIENTO DE AA  [asunto] => Aprobación  [date_abono] => 1 de Noviembre de 2006 [importe] => 0,00 € [fecha_actual] => 12 de Marzo de 2015 ) [2] => Array ( [nombre] => EMPRESA 1 [nbop] => DESCOMENTAR  [date] => 8 de Marzo de 2006 [registro] => 1175/2006 [numero_recibo] => [organismo] => AYUNTAMIENTO DE CC [asunto] => Notificación de la aprobación  [date_abono] => 0 de de [importe] => 0,00 € [fecha_actual] => 12 de Marzo de 2015 )

And this PHP code after that array is declared:
$DocumentoODT = new clsTinyButStrong; // Nueva instancia de TBS
$DocumentoODT->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // Carga el complemento OpenTBS
$DocumentoODT->LoadTemplate($filename, OPENTBS_ALREADY_UTF8); // Carga en el documento los valores nominados como [onload] desde las variables de PHP definidas en este guión
$DocumentoODT->MergeBlock('bloque','array', $Vector_datos);
// $DocumentoODT->PlugIn(OPENTBS_DEBUG_XML_SHOW);    //Si hay errores, activar ésto, que nos muestra lo que va haciendo
$DocumentoODT->Show(OPENTBS_DOWNLOAD, $filename_salida); // Cierra el documento listo para descargar (no graba nada en el servidor)

Finally I have a one page, without pagebreaks, ODT document with something like this:

[bloque.nombre]

Se publica la inserción número [bloque.registro] (recibo número [bloque.numero_recibo]), ordenada por [bloque.organismo] relativa a:

“[bloque.asunto]”

IMPORTE: [bloque.importe]


But the result ODT is only a one page document with the first values of the array, instead a document with multiple pages (mail merge).

What am I doing wrong?

Thank you
By: Skrol29
Date: 2015-03-12
Time: 12:17

Re: Can't get to mergeblock succesfully with ODT document

Hi Rafael,

« If no block's definition is found in the template, then the MergeBlock() method will merge the first record with all linked fields found in the template. »
http://www.tinybutstrong.com/manual.php#php_mergeblock

You have to add parameter "block=tbs:page" in one of your TBS fields.

By: Rafael
Date: 2015-03-13
Time: 10:21

Re: Can't get to mergeblock succesfully with ODT document

Hi again

I added ";block=tbs.page" to the last TBS field on my ODT document. That is:
[bloque.importe;block=tbs.page]

But same result!!!

However, if I put that string in de penultimate TBS field ("bloque.asunto" is this case), TBS show me an error:

TinyButStrong Error in block's definition [bloque.asunto...]: at least one tag corresponding to tbs.page is not found. Check opening tags, closing tags and embedding levels.

TinyButStrong Error Show() Method: The output is cancelled by the OpenTBS plugin because at least one error has occured.

I'm lost at this point

:(
By: Rafael
Date: 2015-03-13
Time: 12:54

Re: Can't get to mergeblock succesfully with ODT document

Solved. Your solution was fine. I was using a "." instead ":". Was my fault.

THANK YOU