I don't know if you can read JS Jquery but this is what I'd like to do server sided instead of client sided: $('p').wrapInner('<span class="contentsInP" />');
I'd like to take all existing paragraphs from a page and wrap their contents in a new span with a specific class.
Luckily all my documents are HTML5 in its XML flavour and are valid so that in PHP I can do this (simplified):
$xml=new DOMDocument(); $xml->loadXML($html); $xpath = new DOMXPath($xml); // How to go on in here to wrap my p's? $output=$xml->saveXML();
How do I get PHP's DOMXPath to do my wrapping?
No comments:
Post a Comment