Jump to content

[SOLVED] DOMDocument problem


TeNDoLLA

Recommended Posts

Hi,

Does anyone have any idea how could I remove some elements from a HTML template file if I know the id's of these elements? I tried putting and id for a <tr id="test"> element and then removing it without success like this:

 

<?php
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->loadHTML($template);
$e = $doc->getElementById('test');
$e->parentNode->removeChild($e);

 

..but the element does not get removed and no errors are thrown either. Also I did a var_dump($e) and it shows that the element with this id has found.

Link to comment
https://forums.phpfreaks.com/topic/175516-solved-domdocument-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.