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.
In your example, you are missing a closing parenthesis on the line $docx->replaceVariableByText(array('NAME' => 'John Smith');
should be
$docx->replaceVariableByText(array('NAME' => 'John Smith'));
Otherwise, does replaceVariableByText works in headers? I'm trying to generate a word file that have a variable company name in the headers of some pages. placing $COMPANY_NAME$ in the headers of my template doesn't do the trick.