Forum


Replies: 2   Views: 542
How do i an change variables in template footer
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 ElodieMllr  · 19-04-2023 - 10:33

I have a docx templates with multiple variables.

The variables in my main docx ($VARIABLES$) are changing with the right value with replaceVariableByText.

But in my footer, the variables (who contains sames values as the main ) are not changing (I keep $VARIABLES$ instead of the right value).

My text in the docx footer seems embedded so I don't know why is it not working 

 

I was maybe thinking that it is because my footer is another section in the docx but my footer is already Link to previous

Posted by admin  · 19-04-2023 - 10:52

Hello,

As default, replacements are done in the body target. You can set other targets: header, footer, comment, footnote and endnote using the target option available in template methods.

We recommend you read the following documentation page: Replace placeholders in targets and also the Practical guide Working with templates. Both pages detail replacements with samples.

Regards.

Posted by ElodieMllr  · 19-04-2023 - 11:24

Working thank you.

 

I have just add :

 

        $options = array('target' => 'footer');

        $docx->replaceVariableByText($variables);

        $docx->replaceVariableByText($variables, $options);