Replies: 3   Views: 3370
Replacetemplatevariablebyhtml warnings
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 ellytronic  · 10-04-2014 - 08:00


When I'm trying to add HTML into a document, I am seeing a couple warnings arise:

"Strict standards: Accessing static property HTML2WordML::$customListStyles as non static in phpdocx/classes/ on line 46"

The code still works fine, but it's generating the warnings. Any thoughts why? I have confirmed the variables all exist.

My code:

class merger {

    public function parse_variables( $variables, $existing_file, &$new_docx_filename ) {

        $docx = new createDocx();

        $docx->addTemplate( $existing_file );

        $html_var_options = array(

            'isFile'             => false,

            'baseURL'            => '',

            'customListStyles'    => '',

            'downloadImages'    => 'false',

            'filter'            => null,

            'parseAnchors'        => false,

            'parseDivsAsPs'        => true,

            'parseFloats'        => true,

            'strictWordStyles'    => false,

            'wordStyles'        => null


        foreach( $variables as $v ) {

              $docx->replaceTemplateVariableByHTML( $v['to_replace'], 'inline', $v['replace_with'], $html_var_options );


        $docx->createDocx( $new_docx_filename );


        $new_docx_filename .= ".docx";



$variables = array(


            'to_replace'      => 'TOC_LIST',

            'replace_with'     => nl2br( $_REQUEST['toc_contents'] ),

            'method'        => 'replaceTemplateVariableByHTML'



            'to_replace'      => 'TOC_PAGES',

            'replace_with'     => implode( "<br>", $merger->page_counts ),

            'method'        => 'replaceTemplateVariableByHTML'



$merger->parse_variables( $variables, $existing_file, $new_docx_filename );

Posted by jorgelj  · 10-04-2014 - 08:52


It's a notice due to 'Strict standards'. It's solved in the current dev version but you hide this messages in your PHP config.


Posted by ellytronic  · 10-04-2014 - 17:10

That's fine then. Just wanted to make sure I wasn't doing anything incorrectly. I'll hide the errors during production anyway.