TeNDoLLA Posted September 25, 2009 Share Posted September 25, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/175516-solved-domdocument-problem/ Share on other sites More sharing options...
TeNDoLLA Posted September 25, 2009 Author Share Posted September 25, 2009 Nevermind, I had forgotten to save the new document (lol). The above works just fine. Quote Link to comment https://forums.phpfreaks.com/topic/175516-solved-domdocument-problem/#findComment-924859 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.