Replies: 2   Views: 3516
Page break in template variable
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 itlearning  · 18-04-2013 - 15:57


I want to ask, if there is a possibility to insert page break into template variable.

I have variable $PAGEBREAK$ and in PHP, I want to make such thing:

if ($insertbreak) {

$docx->addTemplateVariable('PAGEBREAK', $docx->addBreak(array('type'=>'page')));


else { $docx->cleanTemplateVariable('PAGEBREAK'); }

It however doesn't work, I've tried also parameter rawWordML and it didn't work anyway..

Could you please help me? Thank you a lot!

Posted by itlearning  · 18-04-2013 - 16:09

Ok, I've already found a solution :-)

$docx->replaceTemplateVariableByHTML('PAGEBREAK', 'block', '<p style="page-break-before: always;">aaa</p>');