php-html-parser
php-html-parser copied to clipboard
Hi, is there a way to set the inner HTML?
I need this to change the inner HTML of a paragraph...
Hey @markusantonwolf ,
Can you please give me an example of how you would like this to work? Any idea would be appreciated.
Hi @paquettg,
for testing I added ->__get() to the object so I was able to change every value. In my case it was 'cause I wanted to change a link and replace the text with the href. Much better for text and html emails....
Hi, was this ever resolved? can you provide a usage example? thanks!
It would be really nice if there could be a loadStr function for child nodes. Like this:
$dom = new Dom;
$dom->loadStr("<html><body></body></html>");
$dom->find("body")->loadStr("<div id='mydiv'>hello world!</div>");
Of course, we can still use TextNode - BUT - that does not create retrievable nodes:
$dom = new Dom;
$dom->loadStr("<html><body></body></html>");
$body = $dom->find("body")->addChild(new TextNode("<div id='mydiv'><div id='anotherdiv'><b>Hello World!!!</b> how are you?</div></div>"));
echo $dom->find("#anotherdiv")->outerHTML;
causes the error: The collection does not contain any Nodes..