I am trying to break parts of my dynamic HTML created with DOMDocument into function. There are certain places where I have multiple blocks of identical code. This sample shows what I am using to achieve this:
[code]$dom_obj- = new DOMDocument(“1.0”, “UFT-8”); // The DOMDocument object for this function.
$helper1 = new DOMDocument(“1.0”, “UFT-8”);
$result_html_string = other_DOMDocument_function($parameter); // saveHTML() output from the another function.
$helper1->loadHtml($result_html_string);
$dom_obj->appendChild($dom_obj->importNode($helper1->documentElement, true));
return $dom_obj->saveHTML();
The only thing is this automatically puts a “HTML” and “BODY” tags at the start and end of the code block, which I do not need.
Is there a better way of breaking DOMDocument functions down to smaller functions?
Any thoughts will be appreciated.