<?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: Header for XML content in PHP file</title>
	<atom:link href="http://www.satya-weblog.com/2008/02/header-for-xml-content-in-php-file.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.satya-weblog.com/2008/02/header-for-xml-content-in-php-file.html</link>
	<description>a web development blog</description>
	<lastBuildDate>Sat, 31 Jul 2010 17:21:21 +0530</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: John Minton</title>
		<link>http://www.satya-weblog.com/2008/02/header-for-xml-content-in-php-file.html/comment-page-1#comment-422</link>
		<dc:creator>John Minton</dc:creator>
		<pubDate>Wed, 07 Oct 2009 16:54:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.satyakaran.com/2008/02/header-for-xml-content-in-php-file.html#comment-422</guid>
		<description>Just a quick note if anyone is having some trouble, I read something yesterday stating that a space is needed between the colon and the word &quot;text&quot;, like so:



This rule should apply to any header as far as I&#039;m aware. ALWAYS put a space after the colon. I guess some browsers have issues with that or something? Maybe it&#039;s because the RFC defines the Content-Type as such?...just my 2 cents.

I am working on http://theghostbay.org, creating a site map. Since my most important content is in a database, I can can create a list of all the links on my site really easily. All that is needed is to make it an XML file, using the content header to achieve this from a php file.

Code Sample:

&lt;?php
// connect to database
include(&quot;config.php&quot;);

// set header
header(&quot;Content-Type: text/xml&quot;);

// start xml content for site map
echo &quot;
&quot;;


// query
$gt = mysql_query(&quot;SELECT * FROM pages&quot;);

// loop through query
while($agt = mysql_fetch_array($gt)){

// Extract...if a column name is &quot;col&quot;, then extract will turn it into &quot;$col&quot;.
// It pulls it out of the array!
// so $agt[&#039;col&#039;] has now been converted to $col.
// This is an awesome function, http://php.net/extract
// Cols: id name torrent description
extract($agt);

// ,,  and  are the only required entries as such:
echo &quot;
   
      http://theghostbay.org/index.php?torrent=$id
      $lastmodified
      monthly
      0.6
   &quot;;
}

echo &quot;&quot;;

// read more about site maps via http://www.sitemaps.org/protocol.php


?&gt;</description>
		<content:encoded><![CDATA[<p>Just a quick note if anyone is having some trouble, I read something yesterday stating that a space is needed between the colon and the word &#8220;text&#8221;, like so:</p>
<p>This rule should apply to any header as far as I&#8217;m aware. ALWAYS put a space after the colon. I guess some browsers have issues with that or something? Maybe it&#8217;s because the RFC defines the Content-Type as such?&#8230;just my 2 cents.</p>
<p>I am working on <a href="http://theghostbay.org" rel="nofollow">http://theghostbay.org</a>, creating a site map. Since my most important content is in a database, I can can create a list of all the links on my site really easily. All that is needed is to make it an XML file, using the content header to achieve this from a php file.</p>
<p>Code Sample:</p>
<p>&lt;?php<br />
// connect to database<br />
include(&quot;config.php&quot;);</p>
<p>// set header<br />
header(&quot;Content-Type: text/xml&quot;);</p>
<p>// start xml content for site map<br />
echo &quot;<br />
&#8220;;</p>
<p>// query<br />
$gt = mysql_query(&#8220;SELECT * FROM pages&#8221;);</p>
<p>// loop through query<br />
while($agt = mysql_fetch_array($gt)){</p>
<p>// Extract&#8230;if a column name is &#8220;col&#8221;, then extract will turn it into &#8220;$col&#8221;.<br />
// It pulls it out of the array!<br />
// so $agt['col'] has now been converted to $col.<br />
// This is an awesome function, <a href="http://php.net/extract" rel="nofollow">http://php.net/extract</a><br />
// Cols: id name torrent description<br />
extract($agt);</p>
<p>// ,,  and  are the only required entries as such:<br />
echo &#8221;</p>
<p>      <a href="http://theghostbay.org/index.php?torrent=$id" rel="nofollow">http://theghostbay.org/index.php?torrent=$id</a><br />
      $lastmodified<br />
      monthly<br />
      0.6<br />
   &#8220;;<br />
}</p>
<p>echo &#8220;&#8221;;</p>
<p>// read more about site maps via <a href="http://www.sitemaps.org/protocol.php" rel="nofollow">http://www.sitemaps.org/protocol.php</a></p>
<p>?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danish</title>
		<link>http://www.satya-weblog.com/2008/02/header-for-xml-content-in-php-file.html/comment-page-1#comment-168</link>
		<dc:creator>Danish</dc:creator>
		<pubDate>Mon, 23 Feb 2009 20:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.satyakaran.com/2008/02/header-for-xml-content-in-php-file.html#comment-168</guid>
		<description>Satya Prakash Karan&lt;br/&gt;thanks ver much&lt;br/&gt;&lt;br/&gt;i found very easy after getting this from you&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;admin@yiippee.com</description>
		<content:encoded><![CDATA[<p>Satya Prakash Karan<br />thanks ver much</p>
<p>i found very easy after getting this from you</p>
<p><a href="mailto:admin@yiippee.com">admin@yiippee.com</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
