Forum


Replies: 4   Views: 3431
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:

[code]
$docx = new CreateDocx();

$settings = array(
'header' => true
);

$docx->addTemplate('templates/bl_bluebrieftemplate.docx');
$docx->setTemplateSymbol('$');
$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);
$docx->createDocx('outputs/bluebrief_'.date("H_i_s"));
[/code]

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

Posted by admin  · 11-04-2013 - 12:13

Hello,

The next version of phpdocx pro will solve an issue that fail when there're more than one header created by Word.

Regards.

Posted by brieflogic  · 11-04-2013 - 12:13

Thanks for the update...

When is the update set for release? Is there any suggested work around in the short term? (or perhaps a beta/alpha release we could work with)

thanks.

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please send us an email (http://www.phpdocx.com/contact).

Regards.