Replies: 4   Views: 3824
Replace variables in header not working
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 brieflogic  · 08-08-2011 - 01:24

Hello, I'm trying to replace a few tokens in the header and footer... these are noted in the docx template file with preceeding and concluding '$'.... i.e. $BRIEFTITLE$, and so on.

Here is the code:

$docx = new CreateDocx();

$settings = array(
'header' => true

$docx->addTemplateVariable('BRIEFTITLE', 'Testing Brief ' . date("H:i:s"),$settings);
$docx->addTemplateVariable('BRIEFTEMPLATE', 'dock trial of template use '. date("H:i:s"),$settings);
$docx->addTemplateVariable('BRIEFCONTENT', 'Body Content '. date("H:i:s"),$settings);
$docx->addTemplateVariable('BRIEFFOOTER', 'Footer Content ' . date("H:i:s"),$settings);
$docx->addTemplateVariable('BRIEFACCOUNT', 'Account Name '. date("H:i:s"),$settings);
$docx->addTemplateImage('BRIEFLOGO', 'path/to/file.gif',$settings);

the file renderes, and only briefcontent variable is replaced. The others are not... any ideas?