Forum


Replies: 3   Views: 3870
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

Hello,



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/HTML2WordML.inc 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 );

        unset($docx);

        $new_docx_filename .= ".docx";

    }



}



$variables = array(

        array(

            'to_replace'      => 'TOC_LIST',

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

            'method'        => 'replaceTemplateVariableByHTML'

            ),

        array(

            '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

Hello,



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.



Regards.


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.