note 89802 added to book.dom
| From: | xwisdom at yahoo dot com | Date: | Tue, 24 Mar 2009 04:49:06 +0000 |
| Subject: | note 89802 added to book.dom | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152363@lists.php.net to get a copy of this message | ||
Hello,
Here's another way you can get the inner and outer html content of a element:
// code taken from the Raxan PDI framework
// returns the html content of an element
protected function nodeContent($n, $outer=false) {
$d = new DOMDocument('1.0');
$b = $d->importNode($n->cloneNode(true),true);
$d->appendChild($b); $h = $d->saveHTML();
// remove outter tags
if (!$outer) $h = substr($h,strpos($h,'>')+1,-(strlen($n->nodeName)+4));
return $h;
}
There are lots of other PHP DOM manipulation and traversing APIs available at the website. See here
http://raxanpdi.com/pdi-overview.html
----
Server IP: 190.15.66.25
Probable Submitter: 72.27.189.119
----
Manual Page -- http://www.php.net/manual/en/book.dom.php
Edit -- https://master.php.net/note/edit/89802
Del: integrated -- https://master.php.net/note/delete/89802/integrated
Del: useless -- https://master.php.net/note/delete/89802/useless
Del: bad code -- https://master.php.net/note/delete/89802/bad+code
Del: spam -- https://master.php.net/note/delete/89802/spam
Del: non-english -- https://master.php.net/note/delete/89802/non-english
Del: in docs -- https://master.php.net/note/delete/89802/in+docs
Del: other reasons-- https://master.php.net/note/delete/89802
Reject -- https://master.php.net/note/reject/89802
Search -- https://master.php.net/manage/user-notes.php