TinyButStrong - the PHP Template Engine
Categories > OpenTBS with ODT >

Repeat same table with different data each time

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

By: Adam
Date: 2011-05-29
Time: 23:18

Repeat same table with different data each time

Hello,

I need to generate multipage odt file. Each page is a simple table contains plane flight data. It is possibile to make template with 1 table and repeat it with different data (and different amount of rows in table) ? Sample

Plane1 2010-01-01

Table1

<new_page>

Plane1 2010-01-02

Table2

<new_page>

Plane1 2010-01-03

Table3


Regards
Adam
By: Skrol29
Date: 2011-05-30
Time: 00:09

Re: Repeat same table with different data each time

Hello Adam,

Yes it's possible using Sub-blocks.
See http://www.tinybutstrong.com/manual.php#html_block_subblock
By: Adam
Date: 2011-06-05
Time: 12:14

Re: Repeat same table with different data each time

Hello,

My code:

<?php

include_once('tbs_class.php');
include_once('tbs_plugin_opentbs.php');

$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);

$template='demo_oo_text2.odt';
$TBS->LoadTemplate($template);
$file_name = str_replace('.','_'.date('Y-m-d').'.',$template);

$template='demo_oo_text.odt';

$data = array();
$data2 = array();
$data2[] = array('a' => 'table1', 'a' => 'table2', 'a' => 'table3');
$data[] = array('firstname'=>'Sandra', 'name'=>'Hill', 'number'=>'1' );
$data[] = array('firstname'=>'Roger', 'name'=>'Smith', 'number'=>'2' );
$data[] = array('firstname'=>'Adam', 'name'=>'Smith', 'number'=>'3' );

$TBS->MergeBlock('a', $data);
$TBS->MergeBlock('table', $data2);

$TBS->Show(OPENTBS_DOWNLOAD, $file_name);

?>


Template:

Table [table.a;block=begin]

First Name Name Membership number
[a.firstname;block=table:table-row] [a.name] [a.number]

[table.b;block=end]

I expect to see three identical tables, but I see only one. What am I doing wrong?

Regards
Adam
By: william
Date: 2011-06-05
Time: 16:59

Re: Repeat same table with different data each time

I sent Adam the php program and template I use for my patient statements for his perusal
By: Adilson
Date: 2011-07-28
Time: 23:46

Re: Repeat same table with different data each time

Willian,

Your code have dynamic columns?

Att,

Adilson
By: william
Date: 2011-07-29
Time: 17:42

Re: Repeat same table with different data each time

The columns are static: ie: the same columns on each wow, but different data in each column for each row.
Is that clear ?
By: NinoV
Date: 2012-01-30
Time: 06:44

Re: Repeat same table with different data each time

Hi Adam,

I have the same problem. If you solved  it, could you please send me the php program and the template.

Thank you very much,
Nino
By: bill
Date: 2012-01-30
Time: 14:26

Re: Repeat same table with different data each time

Glad too, might take a few days though.  If you haven't received it by Wed, please write me again.
By: simo
Date: 2015-10-16
Time: 18:21

Re: Repeat same table with different data each time

Hi,

I have the same problem, and please I need the solution ASAP.

Thank's