I am trying to replace one of my div's content:
$html = new DOMDocument();
$html->loadHTML($content);
$elements = $html->getElementsByTagName('div');
foreach($elements as $element){
if($element->getAttribute('name') == "left_0"){
$element->nodeValue = "<h2>Title</h2>";
}
echo $html-> saveHTML();
I get the following output in my index.php:
<h2>Title</h2>
I was looking for an answer, but cant find a way to fix it. Thanks!