html - to manipulate the DOM of the current page using PHP? -
i know how manipulate dom of current page using php. explanation below:
this code in php file:
<div id="edittitle" title="editing title"> <b>1</b> </div> $strhtml=; libxml_use_internal_errors( true ); $dom=new domdocument('1.0','utf-8'); $dom->validateonparse=false; $dom->loadhtml( $strhtml ); libxml_clear_errors(); $col=$dom->getelementsbytagname('b'); echo $col->item(0)->nodevalue;
actually, want putting whole html code exists in current file (the php file) in variable $strhtml
(please focus on following line of code: $strhtml=;
). there idea how that?
thanks in advance.
if want can putting of html in output buffer while / before sending browser (the latter can done output control). can dom parse "captured" html.
but should ask trying achieve , if not better suited client-side (i.e. javascript) code.
Comments
Post a Comment