Currently I'm trying to figure out how to take a small bit of html, say
<input name="tesT" value="YAY" />
or
<input name="tesT" value="YAY">
or
<textarea name="moo">blah</textarea>
Edit, say, the value (Or innerHTML), an attribute or two, add an attribute, take one out, etc... Then export it back the same way it came in, but with the modifications. But I'm having two problems that are annoying me to no end.
1) I don't usually work with DOM, so I'm not quite sure how to edit attributes and the like. The HTML aspect isn't well documented, so any help here would be nice.
2) I'm getting extremely annoyed by the fact saveHTML() AND saveXML() both add all the extra stuff that I don't want. What's worse, it looks like even by importing the HTML with loadHtml, it adds the body tags which I don't need or want. How do I get around this? I want JUST the element(s) that go in, to come out.
$domdoc = new DOMDocument();
$domdoc->validateOnParse = false;
$domdoc->loadHtml($element);
$textarea = $domdoc->getElementsByTagName("textarea");
$xml = simplexml_import_dom($domdoc);
PrintNeatArrays($xml);
This is pretty much all I have right now.
Any help would be appreciated, thanks.