I would like to print multiple documents from a single template, with each document containing different data. Basically loop through some array using a single template. My expectation was that I could do this and then get multiple files to open -- but instead I get only the data from the first run through the loop. Here's an example:
<?php
include_once('../tbs/tbs_class.php');
include_once('../tbs/tbs_plugin_opentbs.php');
$count=0;
while ($count<=2) {
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$template="../templates/test.odt";
$TBS->LoadTemplate($template);
// Define the name of the output file
$fileName="test_$count.odt";
// download
$TBS->Show(OPENTBS_DOWNLOAD, $fileName);
$count++;
}
?>
|
text of my template named test.odt:
Simple Example
Variable: [onshow.count]
|
So what I expected was three documents named test_0.odt, test_1.odt, test_2.odt with the numbers 0,1,2 in the document respectively. What I get is just test_0.odt with the number 0 in the document.
Is there a way to do this -- generate multiple documents from one template using a loop?