Forum


Replies: 2   Views: 3359
Addtemplatevariable bugs
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 asnanblt  · 12-10-2012 - 10:17

Hi

I got the problem. When i use array for template

[code]
$docx = new CreateDocx();
$arraytemplate = array("Name :","My name","Email :","myemail@gmail.com");
$docx->addTemplate("template.docx");
$docx->addTemplateVariable('MYDETAIL', $arraytemplate);
$docx->createDocxAndDownload('templateresult.docx');
[/code]

When on template.docx we place $MYDETAIL$ once, it will work ok... But when place twice, it result like this

Name :
My name
Email :
myemail@gmail.com
$MYDETAIL$
$MYDETAIL$
$MYDETAIL$
$MYDETAIL$
$MYDETAIL$


Please let me know what happen ? Or we not alowe add that variable twice on document ?

Thank You
Salnan

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

Hello,

You're right, you should add only one placeholder with the same name.

Regards.