Replies: 3   Views: 3690
Remove unused variables
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 mbcalvin  · 27-09-2012 - 19:39

I looked through your documentation but haven't found any way to remove variables from a template if they are not filled. Is there any way to do this.

I looked at using blocks, but a lot of my variables are inline, and using $docx->clearBlocks() removes the whole line.


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


Phpdocx doesn't remove not used placeholders. Your script must control them and remove if needed or any other task.
To remove a placeholder just replace it using a blank space.


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

Thanks for the fast response. As a feature request, maybe future versions could have a removeEmptyVariables() function.