<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: innerHTML in php-dom</title>
	<atom:link href="http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/feed/" rel="self" type="application/rss+xml" />
	<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/</link>
	<description>php, linux, ajax, javascript, kae verens</description>
	<lastBuildDate>Fri, 05 Mar 2010 01:53:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ??????? &#187; [Web] ????</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-118519</link>
		<dc:creator>??????? &#187; [Web] ????</dc:creator>
		<pubDate>Wed, 25 Nov 2009 02:35:01 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-118519</guid>
		<description>[...] innerHTML in php-dom [...]</description>
		<content:encoded><![CDATA[<p>[...] innerHTML in php-dom [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Om Prakash Chowdhury</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-109418</link>
		<dc:creator>Om Prakash Chowdhury</dc:creator>
		<pubDate>Sat, 15 Nov 2008 10:53:47 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-109418</guid>
		<description>HI,

Can i use innerhtml using Php?

Thanks
Om</description>
		<content:encoded><![CDATA[<p>HI,</p>
<p>Can i use innerhtml using Php?</p>
<p>Thanks<br />
Om</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: patrick smith</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-108820</link>
		<dc:creator>patrick smith</dc:creator>
		<pubDate>Tue, 04 Nov 2008 15:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-108820</guid>
		<description>Expanding on Lokesh&#039;s solution...

To get the innerHTML of a specific element ($elem_id) in a specific html file ($filepath), you have to accommodate multiple children in that element:

$innerHTML = &#039;&#039;;
$doc = new DOMDocument();
$doc-&gt;loadHTMLFile($filepath);	
$elem = $doc-&gt;getElementById($elem_id);

// loop through all childNodes, getting html		
$children = $elem-&gt;childNodes;
foreach ($children as $child) {
    $tmp_doc = new DOMDocument();
    $tmp_doc-&gt;appendChild($tmp_doc-&gt;importNode($child,true));		
    $innerHTML .= $tmp_doc-&gt;saveHTML();
}</description>
		<content:encoded><![CDATA[<p>Expanding on Lokesh&#8217;s solution&#8230;</p>
<p>To get the innerHTML of a specific element ($elem_id) in a specific html file ($filepath), you have to accommodate multiple children in that element:</p>
<p>$innerHTML = &#8221;;<br />
$doc = new DOMDocument();<br />
$doc-&gt;loadHTMLFile($filepath);<br />
$elem = $doc-&gt;getElementById($elem_id);</p>
<p>// loop through all childNodes, getting html<br />
$children = $elem-&gt;childNodes;<br />
foreach ($children as $child) {<br />
    $tmp_doc = new DOMDocument();<br />
    $tmp_doc-&gt;appendChild($tmp_doc-&gt;importNode($child,true));<br />
    $innerHTML .= $tmp_doc-&gt;saveHTML();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lokesh</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-105417</link>
		<dc:creator>Lokesh</dc:creator>
		<pubDate>Wed, 01 Oct 2008 10:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-105417</guid>
		<description>Hi Guys, 

There is an easy and clean way of doing it using DOMDocument class itself.

See the example below.

function convertNodeToDOM($domNode) {

	//this function receives a node and converts it to Dom document

	$doc = new DOMDocument();

	$doc-&gt;appendChild($doc-&gt;importNode($domNode,true));

	return $doc;

	}


$tmpDOM = convertNodeToDOM($tmpDiv); //tmp div can be retrieves using getElementById etc
	
$innerHTML = saveHTML($tmpDOM);


Regards,
Lokesh</description>
		<content:encoded><![CDATA[<p>Hi Guys, </p>
<p>There is an easy and clean way of doing it using DOMDocument class itself.</p>
<p>See the example below.</p>
<p>function convertNodeToDOM($domNode) {</p>
<p>	//this function receives a node and converts it to Dom document</p>
<p>	$doc = new DOMDocument();</p>
<p>	$doc-&gt;appendChild($doc-&gt;importNode($domNode,true));</p>
<p>	return $doc;</p>
<p>	}</p>
<p>$tmpDOM = convertNodeToDOM($tmpDiv); //tmp div can be retrieves using getElementById etc</p>
<p>$innerHTML = saveHTML($tmpDOM);</p>
<p>Regards,<br />
Lokesh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kae Verens</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-103864</link>
		<dc:creator>Kae Verens</dc:creator>
		<pubDate>Sat, 20 Sep 2008 18:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-103864</guid>
		<description>Adrian - totally fine. you&#039;re free to use it as you wish.</description>
		<content:encoded><![CDATA[<p>Adrian &#8211; totally fine. you&#8217;re free to use it as you wish.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adrian</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-103848</link>
		<dc:creator>Adrian</dc:creator>
		<pubDate>Sat, 20 Sep 2008 13:46:14 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-103848</guid>
		<description>Hello!

This is a wonderful script, good work! It really saved my day. 
Thank you so much! Hope its okey to use it as part in a little cms 
system where building?

In any way, please send me a mail telling its okey.
Otherwise I will remove it.

Thanks!

Best regards
Adrian</description>
		<content:encoded><![CDATA[<p>Hello!</p>
<p>This is a wonderful script, good work! It really saved my day.<br />
Thank you so much! Hope its okey to use it as part in a little cms<br />
system where building?</p>
<p>In any way, please send me a mail telling its okey.<br />
Otherwise I will remove it.</p>
<p>Thanks!</p>
<p>Best regards<br />
Adrian</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kae Verans&#8217; Blog: innerHTML in php-dom &#124; Development Blog With Code Updates : Developercast.com</title>
		<link>http://verens.com/archives/2008/07/28/innerhtml-in-php-dom/comment-page-1/#comment-98635</link>
		<dc:creator>Kae Verans&#8217; Blog: innerHTML in php-dom &#124; Development Blog With Code Updates : Developercast.com</dc:creator>
		<pubDate>Mon, 28 Jul 2008 16:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://verens.com/?p=476#comment-98635</guid>
		<description>[...] Verans has written up a handy snippet of code to try to mimic the innerHTML property that Javascript lets you have access [...]</description>
		<content:encoded><![CDATA[<p>[...] Verans has written up a handy snippet of code to try to mimic the innerHTML property that Javascript lets you have access [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
