Replies: 5   Views: 3238
Create multiple documents by template?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by marcushjortsberg  · 09-08-2011 - 02:53

I want to achieve one thing.

I want to make one file that contains several pages, every page should look the same as the others except for some bits of info. I have a template that I try to import and make a foreach loop and create one file, something like

require_once '';
$docx = new CreateDocx();
foreach ($allthings as $allthing)

$docx->addHeader($header, $paramsHeader);

$docx->addTemplateVariable('INFO', $allthing->info);
$docx->addTemplateVariable('INFO"', $allthing->info2);
$docx->addTemplateVariable('CONCATINFO3AND4', $allthing->info3 . ' ' . $allthing->info4);

$filename = $allthing->info;

but only one page is created...ideas?