I am creating a mobile optimized version of a website, built dynamically through php. I have started using the php DOM and it seems to be what I am looking for.
I am having trouble writing all the child nodes of a div. I start with something like this
$DOM = new DOMDocument;
$DOM->loadHTML($html);
$divContents = $DOM->getElementById('c1');
lets say within $html
the div c1 look like this:
<div id="c1">
<img src="myimage.png" />
<p>The div c1 contains this paragraph element</p>
<span><strong>As well as these span and bolding elements</strong></span>
</div>
how can I extract the entire contents of c1, including tags and nodeValues and end up with and echo statement, or the equivalent that looks like this:
echo ' <img src="myimage.png" />
<p>The div c1 contains this paragraph element</p>
<span><strong>As well as these span and bolding elements</strong></span>';