<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Tech Space</title>
	<atom:link href="http://www.thetechspace.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetechspace.com</link>
	<description>php, jquery, flash and resources</description>
	<lastBuildDate>Fri, 21 May 2010 08:12:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get Unlimited Parent and Child in PHP</title>
		<link>http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/</link>
		<comments>http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/#comments</comments>
		<pubDate>Fri, 21 May 2010 08:12:39 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=321</guid>
		<description><![CDATA[Well, let me ask you first. Have you already known about recursion? If not, recursion mean reuse function in this function.
How is it ? For eg Like
function one_function ($var){
           one_function(332);
}

OK , So , how to related with this post title ? I would like to [...]]]></description>
			<content:encoded><![CDATA[<p>Well, let me ask you first. Have you already known about recursion? If not, recursion mean reuse function in this function.</p>
<p>How is it ? For eg Like</p>
<pre class="brush:php">function one_function ($var){
           one_function(332);
}
</pre>
<p>OK , So , how to related with this post title ? I would like to say absolutely related with recursion. Let&#8217;s say, we would like to create category with parent and child.so, we have one table in database, category table. Table Structure Like:</p>

<table id="wp-table-reloaded-id-1-no-1" class="wp-table-reloaded wp-table-reloaded-id-1">
<thead>
	<tr class="row-1 odd">
		<th class="column-1">id</th><th class="column-2">name</th><th class="column-3">p_id</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">1</td><td class="column-2">Main Parent</td><td class="column-3">0</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">2</td><td class="column-2">Sub Parent</td><td class="column-3">1</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">3</td><td class="column-2">Child</td><td class="column-3">2</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">4</td><td class="column-2">Parent 2</td><td class="column-3">0</td>
	</tr>
	<tr class="row-6 even">
		<td class="column-1">5</td><td class="column-2">Child 2</td><td class="column-3">4</td>
	</tr>
	<tr class="row-7 odd">
		<td class="column-1">6</td><td class="column-2">Child 3</td><td class="column-3">4</td>
	</tr>
	<tr class="row-8 even">
		<td class="column-1">7</td><td class="column-2">Child 4</td><td class="column-3">5</td>
	</tr>
</tbody>
</table>

<p><span id="more-321"></span>So, now I have created one table. I would like to get the out put like:</p>
<p>Main Parrent<br />
- Sub Parent<br />
&#8211; Child of sub parent<br />
Parent 2<br />
-  Child 2<br />
&#8211; Child of child 2<br />
- Child 3</p>
<p>So, how will you do it? How could we get it?</p>
<p>If you write the codes like, for eg :</p>
<pre class="brush:php">   $result = mysql_query ();
   while ( $row = mysql_fetch_assoc($result) ){

      echo $row[name];

      $result = mysql_query ();
      while ( $row = mysql_fetch_assoc($result) ){

            echo '- '.$row[name];
      }

   }
</pre>
<p>It would be work. But. If you have 3 or 4 or 5 levels and so on, you will got the trouble. So, what is the better way for that table? Shell we use recursion ?</p>
<p>I have wrote some code snippets like :</p>
<pre class="brush:php">function display_child($parent, $level) {

		$content= array();
		$sql = "SELECT * from test WHERE p_id='$parent'";
		$result = mysql_query($sql);
	   	while ($row = mysql_fetch_array($result)) {
		   	array_push($content,$row['id']);

			if (in_array($parent, $content)){
				echo $row['name']."
";

			}

			echo str_repeat('-',$level)." ".$row['name']."
";
			display_child($row['id'], $level+1);
	   }

}
</pre>
<p>Usage &#8211; display_child( parent_id, level )</p>
<pre class="brush:php">     display_children(0,0);
</pre>
<p>I hope it would be useful for some of your projects. Enjoy !!!!</p>
<h3><a href="http://www.thetechspace.com/?download=php_recursion" target="_blank">Download Source</a> ( size 2.7 kB)</h3>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;title=Get+Unlimited+Parent+and+Child+in+PHP" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;title=Get+Unlimited+Parent+and+Child+in+PHP" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;title=Get+Unlimited+Parent+and+Child+in+PHP" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;t=Get+Unlimited+Parent+and+Child+in+PHP" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Get+Unlimited+Parent+and+Child+in+PHP+-+http://tinyurl.com/2vqjo2w+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;title=Get+Unlimited+Parent+and+Child+in+PHP" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/&amp;title=Get+Unlimited+Parent+and+Child+in+PHP" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL next and previous record of the current record</title>
		<link>http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/</link>
		<comments>http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 11:11:21 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=311</guid>
		<description><![CDATA[I have thought a lot these days what I should write some tips for beginner. Now, I got it. Have you ever noticed when you visiting and reading on some blogs? You will see previous and next links of current post. I don&#8217;t mean pagination links. If you have seen , have you ever thought [...]]]></description>
			<content:encoded><![CDATA[<p>I have thought a lot these days what I should write some tips for beginner. Now, I got it. Have you ever noticed when you visiting and reading on some blogs? You will see previous and next links of current post. I don&#8217;t mean pagination links. If you have seen , have you ever thought how to retrieve those data from MySQL ? OK , If you haven&#8217;t thought and tried yet. Let&#8217;s see how to do it.</p>
<p>Let says, we have user table. Normally, we write SQL query like :</p>
<pre class="brush:sql">SELECT * FROM user WHERE user_id = 111
</pre>
<p>OK, If your user_id is added by auto increment, it&#8217;s simply write 111 &#8211; 1 and 111 + 1 in your program. If not, how could we got it?<br />
Let&#8217;s see.</p>
<pre class="brush:sql">SELECT *,
(SELECT user_id FROM user WHERE user_id &lt; u.user_id ORDER BY user_id DESC LIMIT 1) AS user_prev,
(SELECT user_id FROM user WHERE user_id &gt; u.user_id ORDER BY user_id ASC LIMIT 1) AS user_next
FROM user AS u WHERE u.user_id=111
</pre>
<p>Enjoy !!! I hope it would be useful for you.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;title=MySQL+next+and+previous+record+of+the+current+record" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;title=MySQL+next+and+previous+record+of+the+current+record" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;title=MySQL+next+and+previous+record+of+the+current+record" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;t=MySQL+next+and+previous+record+of+the+current+record" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=MySQL+next+and+previous+record+of+the+current+record+-+http://tinyurl.com/2vtd97d+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;title=MySQL+next+and+previous+record+of+the+current+record" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/&amp;title=MySQL+next+and+previous+record+of+the+current+record" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to return more than one value or multi value in PHP</title>
		<link>http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/</link>
		<comments>http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 01:13:45 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=297</guid>
		<description><![CDATA[Some of PHP beginners (my friends) always ask me how to return two or more values from function. So , I thought, I may need to write the beginner tip at The Tech Space Blog. If your the advanced PHP programmer, you will say. So easy, It&#8217;s a piece of cake. For beginner, it would [...]]]></description>
			<content:encoded><![CDATA[<p>Some of PHP beginners (my friends) always ask me how to return two or more values from function. So , I thought, I may need to write the beginner tip at The Tech Space Blog. If your the advanced PHP programmer, you will say. So easy, It&#8217;s a piece of cake. For beginner, it would be a little difficult. So, let&#8217;s see how to write it.</p>
<p>For normal function ..</p>
<pre class="brush:php">
&lt;?

function calc ( $a, $b)
{

$sum = $a+$b;
return $sum;

}

echo $calc(2,3);

?&gt;
</pre>
<p>So, If you would like to return two or more value from that function, just only return as an array. Let&#8217;s see.</p>
<pre class="brush:php">
&lt;?php

function calc($a,$b){

$sum = $a+$b;
$multiply = $a * $b;
$divided = $a/$b;
$modulus = $a%$b;

return array( 'sum'=&gt;$sum, 'multiply'=&gt;$multiply, 'divided'=&gt; $divided, 'modulus'=&gt;$modulus );

}

$data = calc(3,4);

echo 'Sum value: '.$data['sum'].'&lt;br /&gt;';
echo 'Multiply value: '.$data['multiply'].'&lt;br /&gt;';
echo 'Divided value: '.$data['divided'].'&lt;br /&gt;';
echo 'Modulus value: '.$data['modulus'].'&lt;br /&gt;';

?&gt;
</pre>
<p>Enjoy !!!</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;title=How+to+return+more+than+one+value+or+multi+value+in+PHP" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;title=How+to+return+more+than+one+value+or+multi+value+in+PHP" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;title=How+to+return+more+than+one+value+or+multi+value+in+PHP" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;t=How+to+return+more+than+one+value+or+multi+value+in+PHP" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=How+to+return+more+than+one+value+or+multi+value+in+PHP+-+http://tinyurl.com/yc47emv+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;title=How+to+return+more+than+one+value+or+multi+value+in+PHP" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/&amp;title=How+to+return+more+than+one+value+or+multi+value+in+PHP" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WP Plugin: Latest Posts by Category Archive</title>
		<link>http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/</link>
		<comments>http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 06:05:30 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=289</guid>
		<description><![CDATA[I have found one plugin for one of my client project . That is latest posts by category. I thought someone would be looking for that kind of plug in like me. That plug in can show posts from categories. Posts can be limit how many post what you would like to show under categories.
Features [...]]]></description>
			<content:encoded><![CDATA[<p>I have found one plugin for one of my client project . That is <a href="http://blogsessive.com/blogging-tools/wp-plugin-latest-posts-by-category-archive/" target="_blank">latest posts by category</a>. I thought someone would be looking for that kind of plug in like me. That plug in can show posts from categories. Posts can be limit how many post what you would like to show under categories.</p>
<p>Features of &#8220;<a href="http://blogsessive.com/blogging-tools/wp-plugin-latest-posts-by-category-archive/" target="_blank">Latest Posts by Category Archive</a>&#8221;</p>
<blockquote>
<ul>
<li>Can be used via hard-coding inside page templates;</li>
<li>Can be used as a widget in your widget-ready areas;</li>
<li>Can be used via shortcodes inside pages’ or posts’ content;</li>
<li>Can be used either inside or outside the loop;</li>
<li>Can limit the archive to certain categories, or exclude certain categories;</li>
<li>Can display or hide post dates;</li>
<li>Can display or hide post excerpts and adjust their length in words;</li>
<li>Can set the number of listed post from 1 to ‘all’.</li>
</ul>
</blockquote>
<p><a href="http://blogsessive.com/blogging-tools/wp-plugin-latest-posts-by-category-archive/" target="_blank">To Download</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;title=WP+Plugin%3A+Latest+Posts+by+Category+Archive" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;title=WP+Plugin%3A+Latest+Posts+by+Category+Archive" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;title=WP+Plugin%3A+Latest+Posts+by+Category+Archive" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;t=WP+Plugin%3A+Latest+Posts+by+Category+Archive" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=WP+Plugin%3A+Latest+Posts+by+Category+Archive+-+http://tinyurl.com/ya3oz46+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;title=WP+Plugin%3A+Latest+Posts+by+Category+Archive" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/&amp;title=WP+Plugin%3A+Latest+Posts+by+Category+Archive" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Output XML using PHP from MySQL database</title>
		<link>http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/</link>
		<comments>http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 05:24:15 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=279</guid>
		<description><![CDATA[Firstly, Let me talk about this post. If your advance level php programmer, this is a piece of cake for you. I would like to say this post for beginner level. It would be a little difficult for a beginner. You may need xml output when you want to integrate with flash and MySQL records [...]]]></description>
			<content:encoded><![CDATA[<p>Firstly, Let me talk about this post. If your advance level php programmer, this is a piece of cake for you. I would like to say this post for beginner level. It would be a little difficult for a beginner. You may need xml output when you want to integrate with flash and MySQL records such as photo gallery, playlist for flash mp3 player, RSS Feeds, and so on.</p>
<p><span id="more-279"></span>I would like to show you an example to create xml playlist. So you can use this in flash mp3 player like JW Player. I have created songs table in my database. songs_id, album_id, songs_title and songs_link fields are included in this table.</p>
<p>In PHP file :</p>
<pre class="brush:php">
&lt;?php
 header('Content-type: text/xml');
 $db_host = &quot;localhost&quot; ; // MySQL Host
 $db_user = &quot;root&quot; ;    // Database Username
 $db_password = &quot;&quot; ; // Database Password
 $db_name = &quot;music&quot; ; // Database Name

 $db_link = mysql_connect(&quot;$db_host&quot;,&quot;$db_user&quot;,&quot;$db_password&quot;);
 mysql_select_db($db_name, $db_link);

?&gt;
 &lt;playlist version=&quot;1&quot; xmlns=&quot;http://xspf.org/ns/0/&quot;&gt;
 &lt;trackList&gt;
 &lt;?php
 $album_id = $_GET[aid];
 $songs = &quot;SELECT * From songs WHERE album_id='$album_id' ORDER BY song_title ASC&quot;;
 $songs_list = mysql_query( $songs, $db_link );
 $songs_total = mysql_num_rows( $songs_list );
 if( $songs_total == 0 )    {    exit;    }
 for( $f = 0; $f &lt; $songs_total; $f++ )
 {
 $each = mysql_fetch_assoc( $songs_list );
 ?&gt;
 &lt;track&gt;
 &lt;title&gt;&lt;?=$each['song_title']?&gt;&lt;/title&gt;
 &lt;location&gt;http://www.yourdomain.com/&lt;?=$each['song_link']?&gt;&lt;/location&gt;
 &lt;/track&gt;
 &lt;?php

 } // End of loop

 ?&gt;
 &lt;/trackList&gt;
 &lt;/playlist&gt;
</pre>
<p>Then you can use call this file with album id like <strong>xml.php?aid=10</strong>.</p>
<h3><a href="http://www.thetechspace.com/?download=php_xml_output" target="_blank">Download Source</a> ( size 745 B)</h3>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;title=Output+XML+using+PHP+from+MySQL+database" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;title=Output+XML+using+PHP+from+MySQL+database" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;title=Output+XML+using+PHP+from+MySQL+database" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;t=Output+XML+using+PHP+from+MySQL+database" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Output+XML+using+PHP+from+MySQL+database+-+http://tinyurl.com/ylzsfru+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;title=Output+XML+using+PHP+from+MySQL+database" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/&amp;title=Output+XML+using+PHP+from+MySQL+database" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Pagination</title>
		<link>http://www.thetechspace.com/2009/11/11/php-pagination/</link>
		<comments>http://www.thetechspace.com/2009/11/11/php-pagination/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 12:38:32 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=268</guid>
		<description><![CDATA[I have look for php pagination source. I got one very nice source code from Stranger Studio. That very nice code if your have a lot of records. You can see at sample preview.

However, this is a lot of lines in the file. If you want to put into a lot of pages, all of [...]]]></description>
			<content:encoded><![CDATA[<p>I have look for php pagination source. I got one very nice source code from <a href="http://www.strangerstudios.com/sandbox/pagination/diggstyle.php">Stranger Studio</a>. That very nice code if your have a lot of records. You can see at sample preview.</p>
<p style="text-align: center;"><img class="size-full wp-image-269 aligncenter" title="PHP Pagination" src="http://www.thetechspace.com/wp-content/uploads/2009/11/php_pagination.jpg" alt="PHP Pagination" width="457" height="33" /></p>
<p>However, this is a lot of lines in the file. If you want to put into a lot of pages, all of code you need to put into those pages. We have to take care about this. That&#8217;s while I have changed to class and functions. That&#8217;s very easy to use. I will share it back.</p>
<p><span id="more-268"></span></p>
<p>Firstly I have created class and function in the <strong>paganition.php</strong> file.</p>
<p>For usage :</p>
<pre class="brush:php">

require_once('pagination.php');
 $sql = 'SELECT * FROM contact';
 $page_name = &quot;page.php&quot;;

 //  pagination($query, $adjacents, $row_per_page, $page_name)
 $pager = new pagination($sql, 3, 20, $page_name );
 $rs = $pager-&gt;paginate();

 while($each = mysql_fetch_assoc($rs))
 {
 // Your Loop Here
 echo $each[name];
 }

 // Pages Navagation
 echo $pager-&gt;pages();
</pre>
<p>So, Page links will be come like &#8220;<strong>pagename.php?page=</strong>&#8221; . If you would like to use with <strong>.htaccess</strong> some think like http://www.yourdomain.com/content/page/page_number , you can easily to change at <strong>pagination.php</strong> . Find, &#8220;<strong>?page=</strong>&#8221; and replace with &#8220;/&#8221; . Then, you can use at page name like</p>
<pre class="brush:php">

$page_name = &quot;http://www.yourdomain.com/content/page&quot;;
</pre>
<p>In CSS.</p>
<pre class="brush:css">

div.pagination {
 padding: 3px;
 margin: 3px;
}

div.pagination a {
 padding: 2px 5px 2px 5px;
 margin: 2px;
 border: 1px solid #AAAADD;

 text-decoration: none; /* no underline */
 color: #000099;
}

div.pagination a:hover, div.pagination a:active {
 border: 1px solid #000099;

 color: #000;
}

div.pagination span.current {
 padding: 2px 5px 2px 5px;
 margin: 2px;
 border: 1px solid #000099;

 font-weight: bold;
 background-color: #000099;
 color: #FFF;
}
div.pagination span.disabled {
 padding: 2px 5px 2px 5px;
 margin: 2px;
 border: 1px solid #EEE;

 color: #DDD;
}
</pre>
<h3><a href="http://www.thetechspace.com/?download=php_pagination" target="_blank">Download Source</a> ( size 2.6 kB)</h3>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;title=PHP+Pagination" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;title=PHP+Pagination" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;title=PHP+Pagination" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/11/11/php-pagination/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;t=PHP+Pagination" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=PHP+Pagination+-+http://tinyurl.com/ybgsac6+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;title=PHP+Pagination" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/11/11/php-pagination/&amp;title=PHP+Pagination" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/11/11/php-pagination/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to parse xml in php?</title>
		<link>http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/</link>
		<comments>http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 08:33:46 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=256</guid>
		<description><![CDATA[When I started and learn php programming language. I have wanted to get data from xml file and read with php. I searched with Google. I got a lot of source codes. Some of codes are working in my local machine but when I upload and test it. It doesn&#8217;t work. I have found some [...]]]></description>
			<content:encoded><![CDATA[<p>When I started and learn php programming language. I have wanted to get data from xml file and read with php. I searched with Google. I got a lot of source codes. Some of codes are working in my local machine but when I upload and test it. It doesn&#8217;t work. I have found some codes are work with almost all of server. I will share it back.</p>
<p><span id="more-256"></span>Firstly, I have created example xml file as songs.xml like :</p>
<pre class="brush:xml">

&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;currentsongs&gt;
&lt;song&gt;
&lt;title&gt;Song Title One&lt;/title&gt;
&lt;artist&gt;artist name&lt;/artist&gt;

&lt;/song&gt;

&lt;song&gt;
&lt;title&gt;Song Title Two&lt;/title&gt;
&lt;artist&gt;Sec artist name&lt;/artist&gt;

&lt;/song&gt;
&lt;/currentsongs&gt;
</pre>
<p>Then in php file :</p>
<pre class="brush:php">
&lt;?php

$objDOM = new DOMDocument();
$objDOM-&gt;load("songs.xml"); //make sure path is correct

$songs = $objDOM-&gt;getElementsByTagName("song");

foreach( $songs as $value )
{
$title = $value-&gt;getElementsByTagName("title");
$song_title  = $title-&gt;item(0)-&gt;nodeValue;

$artist = $value-&gt;getElementsByTagName("artist");
$artist_name  = $artist-&gt;item(0)-&gt;nodeValue;

echo "$song_title - $artist_name &lt;br&gt;";
}

?&gt;
</pre>
<h3><a href="http://www.thetechspace.com/?download=php_xml_read" target="_blank">Download Source</a> ( size 868 B)</h3>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;title=How+to+parse+xml+in+php%3F" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;title=How+to+parse+xml+in+php%3F" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;title=How+to+parse+xml+in+php%3F" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;t=How+to+parse+xml+in+php%3F" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=How+to+parse+xml+in+php%3F+-+http://tinyurl.com/yl4cp5g+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;title=How+to+parse+xml+in+php%3F" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/&amp;title=How+to+parse+xml+in+php%3F" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful WordPress Hacks</title>
		<link>http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/</link>
		<comments>http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 15:18:38 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=228</guid>
		<description><![CDATA[Show related post without a plugin
If you want to show related post in you current post , you can use simple way to show. You just need to copy and paste under following codes into single.php file of your theme. This code will display related posts based on the current post tag(s). It must be [...]]]></description>
			<content:encoded><![CDATA[<h3>Show related post without a plugin</h3>
<p>If you want to show related post in you current post , you can use simple way to show. You just need to copy and paste under following codes into <strong>single.php</strong> file of your theme. This code will display related posts based on the current post tag(s). It must be pasted <strong>within</strong> the loop.</p>
<pre class="brush:php">

&lt;?php
//for use in the loop, list 5 post titles related to first tag on current post
$tags = wp_get_post_tags($post-&gt;ID);
if ($tags) {
 echo 'Related Posts';
 $first_tag = $tags[0]-&gt;term_id;
 $args=array(
 'tag__in' =&gt; array($first_tag),
 'post__not_in' =&gt; array($post-&gt;ID),
 'showposts'=&gt;5,
 'caller_get_posts'=&gt;1
 );
 $my_query = new WP_Query($args);
 if( $my_query-&gt;have_posts() ) {
 while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;
 &lt;p&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;?php
 endwhile;
 }
}
?&gt;
</pre>
<p>source : <a href="http://www.wprecipes.com/how-to-show-related-posts-without-a-plugin" target="_blank">How to: Show related posts without a plugin</a></p>
<p><span id="more-228"></span></p>
<h3>Create WordPress Shortcode for related posts</h3>
<p>You can use WordPress shortcode too.</p>
<p>To create the shortcode, simply open your functions.php file and paste the shortcode function:</p>
<pre class="brush:php">
function related_posts_shortcode( $atts ) {
 extract(shortcode_atts(array(
 'limit' =&gt; '5',
 ), $atts));

 global $wpdb, $post, $table_prefix;

 if ($post-&gt;ID) {
 $retval = '&lt;ul&gt;';
 // Get tags
 $tags = wp_get_post_tags($post-&gt;ID);
 $tagsarray = array();
 foreach ($tags as $tag) {
 $tagsarray[] = $tag-&gt;term_id;
 }
 $tagslist = implode(',', $tagsarray);

 // Do the query
 $q = &quot;SELECT p.*, count(tr.object_id) as count
 FROM $wpdb-&gt;term_taxonomy AS tt, $wpdb-&gt;term_relationships AS tr, $wpdb-&gt;posts AS p WHERE tt.taxonomy ='post_tag' AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id  = p.ID AND tt.term_id IN ($tagslist) AND p.ID != $post-&gt;ID
 AND p.post_status = 'publish'
 AND p.post_date_gmt &lt; NOW()
 GROUP BY tr.object_id
 ORDER BY count DESC, p.post_date_gmt DESC
 LIMIT $limit;&quot;;

 $related = $wpdb-&gt;get_results($q);
 if ( $related ) {
 foreach($related as $r) {
 $retval .= '
 &lt;li&gt;&lt;a title=&quot;'.wptexturize($r-&gt;post_title).'&quot; href=&quot;'.get_permalink($r-&gt;ID).'&quot;&gt;'.wptexturize($r-&gt;post_title).'&lt;/a&gt;&lt;/li&gt;
';
 }
 } else {
 $retval .= '
 &lt;li&gt;No related posts found&lt;/li&gt;
';
 }
 $retval .= '&lt;/ul&gt;
';
 return $retval;
 }
 return;
}
add_shortcode('related_posts', 'related_posts_shortcode');
</pre>
<p>Once done, you can use the following shortcode in your posts to display the related content:</p>
<pre class="brush:html">
[related_posts]
[/pre>

Source : <a href="http://www.wprecipes.com/wordpress-shortcode-to-display-related-posts" target="_blank">WordPress shortcode to display related posts</a>
<h3>Show related post from same category</h3>

If you want to get related post base on category , you can simply add some code in <strong>function.php</strong> file. It displays posts depending of the category. This function have three parameters -
<ul>
<li> $limit (int) amount of posts to display</li>
<li>$catName (bool) echo category name, TRUE or FALSE</li>
<li>$title (string) String for a text before all entries</li>
</ul>
<pre class="brush:php">

/**
 * related post with category
 * @param: int $limit limit of posts
 * @param: bool $catName echo category name
 * @param: string $title string before all entries
 * Example: echo fb_cat_related_posts();
 */
if ( !function_exists('fb_get_cat_related_posts') ) {
 function fb_get_cat_related_posts( $limit = 5, $catName = TRUE, $title = '&lt;h3&gt;Recent Pages&lt;/h3&gt;' ) {

 if ( !is_single() )
 return;

 $limit = (int) $limit;
 $output  = '';
 $output .= $title;

 $category = get_the_category();
 $category = (int) $category[0]-&gt;cat_ID;

 if ( $catName )
 $output .= __( 'Kategorie: ' ) . get_cat_name($category) . ' ';

 $output .= '&lt;ul&gt;';

 $args = array(
 'numberposts' =&gt; $limit,
 'category' =&gt; $category,
 );

 $recentposts = get_posts( $args );
 foreach($recentposts as $post) {
 setup_postdata($post);
 $output .= '&lt;li&gt;&lt;a href=&quot;' . get_permalink($post-&gt;ID) . '&quot;&gt;' . get_the_title($post-&gt;ID) . '&lt;/a&gt;&lt;/li&gt;';
 }

 $output .= '&lt;/ul&gt;';

 return $output;
 }
}

[/pre>

Source : <a href="http://wpengineer.com/related-posts-on-category/" target="_blank">Related Posts on Category</a>
<h3>Display comments and trackbacks separately</h3>

Let's face it: When you're reading comments on a blog post, trackbacks are annoying. It's way better to display it separately from comments.
Open and edit the comments.php file from your theme.

Find the comment loop:
<pre class="brush:php">
foreach ($comments as $comment) : ?&gt;
 // Comments are displayed here
endforeach;
</pre>
<p>Replace it with the following:</p>
<pre class="brush:php">
&lt;ul&gt;
 &lt;?php //Displays comments only
 foreach ($comments as $comment) : ?&gt;
 &lt;?php $comment_type = get_comment_type(); ?&gt;
 &lt;?php if($comment_type == 'comment') { ?&gt;
 &lt;li&gt;//Comment code goes here&lt;/li&gt;
 &lt;?php }
 endforeach;
&lt;/ul&gt;

&lt;ul&gt;
 &lt;?php //Displays trackbacks only
 foreach ($comments as $comment) : ?&gt;
 &lt;?php $comment_type = get_comment_type(); ?&gt;
 &lt;?php if($comment_type != 'comment') { ?&gt;
 &lt;li&gt;&lt;?php comment_author_link() ?&gt;&lt;/li&gt;
 &lt;?php }
 endforeach;
&lt;/ul&gt;
</pre>
<p>Soruce : <a href="http://www.wprecipes.com/jamie-asked-how-can-i-display-comments-and-trackbacks-separately" target="_blank">Jamie asked: “How can I display comments and trackbacks separately?”</a></p>
<h3>List Future Posts</h3>
<p>If you want to display list of future post what you scheduled to be publish, simply paste this code where you would like to be displayed.</p>
<pre class="brush:php">

&lt;div id=&quot;zukunft&quot;&gt;
 &lt;div id=&quot;zukunft_header&quot;&gt;&lt;p&gt;Future events&lt;/p&gt;&lt;/div&gt;
 &lt;?php query_posts('showposts=10&amp;post_status=future'); ?&gt;
 &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
 &lt;div &gt;
 &lt;p class&gt;&lt;b&gt;&lt;?php the_title(); ?&gt;&lt;/b&gt;&lt;?php edit_post_link('e',' (',')'); ?&gt;&lt;br /&gt;
 &lt;span&gt;&lt;?php the_time('j. F Y'); ?&gt;&lt;/span&gt;&lt;/p&gt;
 &lt;/div&gt;
 &lt;?php endwhile; else: ?&gt;&lt;p&gt;No future events scheduled.&lt;/p&gt;&lt;?php endif; ?&gt;
&lt;/div&gt;
</pre>
<p>Source : <a href="http://www.wprecipes.com/how-to-list-future-posts" target="_blank">How to: List future posts</a></p>
<h3>Show popular posts without a plugin</h3>
<p>If you want to show popular post in your post or side bar, you just paste following code where you would like to displayed.</p>
<pre class="brush:php">

&lt;h2&gt;Popular Posts&lt;/h2&gt;
&lt;ul&gt;
&lt;?php $result = $wpdb-&gt;get_results(&quot;SELECT comment_count,ID,post_title FROM $wpdb-&gt;posts ORDER BY comment_count DESC LIMIT 0 , 5&quot;);
foreach ($result as $post) {
setup_postdata($post);
$postid = $post-&gt;ID;
$title = $post-&gt;post_title;
$commentcount = $post-&gt;comment_count;
if ($commentcount != 0) { ?&gt;

&lt;li&gt;&lt;a href=&quot;&lt;?php echo get_permalink($postid); ?&gt;&quot; title=&quot;&lt;?php echo $title ?&gt;&quot;&gt;
&lt;?php echo $title ?&gt;&lt;/a&gt; {&lt;?php echo $commentcount ?&gt;}&lt;/li&gt;
&lt;?php } } ?&gt;

&lt;/ul&gt;
</pre>
<p>Source : <a href="http://www.problogdesign.com/wordpress/create-your-own-popular-posts-page/" target="_blank">Create Your Own Popular Post Page</a></p>
<h3>Highlight Searched Text In Search Results</h3>
<p>If you want to highlight searched text in search resualt, you can get after following step.</p>
<p>Open your search.php file and find the the_title() function. Replace it with the following:</p>
<pre class="brush:php">

echo $title;
</pre>
<p>Now, just before the modified line, add this code:</p>
<pre class="brush:php">

&lt;?php
 $title     = get_the_title();
 $keys= explode(&quot; &quot;,$s);
 $title     = preg_replace('/('.implode('|', $keys) .')/iu',
 '&lt;strong&gt; &lt;/strong&gt;',
 $title);
?&gt;
</pre>
<p>Save the search.php file and open style.css. Append the following line to it:</p>
<pre class="brush:css">

strong.search-excerpt { background: yellow; }
</pre>
<p>Source : <a title="Enlight searched text in search results" href="http://www.wprecipes.com/how-to-enlight-searched-text-in-search-results" target="_blank">Enlight searched text in search results</a></pre>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;title=Useful+WordPress+Hacks" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;title=Useful+WordPress+Hacks" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;title=Useful+WordPress+Hacks" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;t=Useful+WordPress+Hacks" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Useful+WordPress+Hacks+-+http://tinyurl.com/yzyg54b+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;title=Useful+WordPress+Hacks" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/&amp;title=Useful+WordPress+Hacks" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/10/23/useful-wordpress-hacks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>List of pure css drop down menu tutorials</title>
		<link>http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/</link>
		<comments>http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 04:42:56 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[drop-down]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=217</guid>
		<description><![CDATA[Build Multi-level Multi-column Multi Menus with pure CSS

CSS Drop Down Menu


CSS dropdown menu without javascripting or hacks
CSS Express Drop-Down Menus

CSS DropDown Menu Tutorial

Pure CSS Drop Down Menus make your code cleaner and easier to maintain






		
			Share this on del.icio.us
		
		
			Digg this!
		
		
			Stumble upon something good? Share it on StumbleUpon
		
		
			Share this on Technorati
		
		
			Share this on Facebook
		
		
			Tweet This!
		
		
			Share this on [...]]]></description>
			<content:encoded><![CDATA[<h3><a href="http://www.wittysparks.com/2009/09/21/build-multi-level-multi-column-multi-menus-with-pure-css/" target="_blank">Build Multi-level Multi-column Multi Menus with pure CSS</a></h3>
<p><a href="http://apps.wittysparks.com/tutorials/css/pure_css_menu.html" target="_blank"><img class="aligncenter size-full wp-image-218" title="Build Multi-level Multi-column Multi Menus with pure CSS" src="http://www.thetechspace.com/wp-content/uploads/2009/10/css_multi_menu.gif" alt="Build Multi-level Multi-column Multi Menus with pure CSS" width="600" height="300" /></a></p>
<h3><a href="http://pixelspread.com/blog/289/css-drop-down-menu" target="_blank">CSS Drop Down Menu</a></h3>
<p><a href="http://pixelspread.com/demo/cssdropdown.html"><img class="aligncenter size-full wp-image-219" title="CSS Drop Down" src="http://www.thetechspace.com/wp-content/uploads/2009/10/css-drop-down.jpg" alt="CSS Drop Down" width="615" height="250" /></a></p>
<p><span id="more-217"></span></p>
<h3><a href="http://www.texaswebdevelopers.com/blog/template_permalink.asp?id=129" target="_blank">CSS dropdown menu without javascripting or hacks</a></h3>
<h3><a href="http://www.texaswebdevelopers.com/blog/template_permalink.asp?id=129"><img class="aligncenter size-full wp-image-220" title="CSS dropdown menu without javascripting or hacks" src="http://www.thetechspace.com/wp-content/uploads/2009/10/css-dropdown-menu-without-js.jpg" alt="CSS dropdown menu without javascripting or hacks" width="615" height="250" /></a><a href="http://www.projectseven.com/tutorials/navigation/auto_hide/" target="_blank">CSS Express Drop-Down Menus</a></h3>
<p><a href="http://www.projectseven.com/tutorials/navigation/auto_hide/workpage.htm" target="_blank"><img class="aligncenter size-full wp-image-221" title="CSS Express Drop-Down Menu" src="http://www.thetechspace.com/wp-content/uploads/2009/10/css-express-drop-down-menu.jpg" alt="CSS Express Drop-Down Menu" width="615" height="250" /></a></p>
<h3><a href="http://ago.tanfa.co.uk/css/examples/menu/tutorial-h.html" target="_blank">CSS DropDown Menu Tutorial</a></h3>
<p><a href="http://ago.tanfa.co.uk/css/examples/menu/hs7.html" target="_blank"><img class="aligncenter size-full wp-image-222" title="CSS Drop Down Menu Tutorial" src="http://www.thetechspace.com/wp-content/uploads/2009/10/css-drop-down-menu-tutorial.jpg" alt="CSS Drop Down Menu Tutorial" width="615" height="250" /></a><a href="http://www.mywebstuff.com/css-dropdown.html" target="_blank"></a></p>
<h3><a href="http://www.mywebstuff.com/css-dropdown.html" target="_blank">Pure CSS Drop Down Menus make your code cleaner and easier to maintain</a></h3>
<p><a href="http://www.mywebstuff.com/css-dropdown.html"><img class="aligncenter size-full wp-image-223" title="Pure CSS Drop Down" src="http://www.thetechspace.com/wp-content/uploads/2009/10/pure-css-drop-down.jpg" alt="Pure CSS Drop Down" width="615" height="250" /></a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;title=List+of+pure+css+drop+down+menu+tutorials" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;title=List+of+pure+css+drop+down+menu+tutorials" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;title=List+of+pure+css+drop+down+menu+tutorials" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;t=List+of+pure+css+drop+down+menu+tutorials" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=List+of+pure+css+drop+down+menu+tutorials+-+http://tinyurl.com/yaff63u+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;title=List+of+pure+css+drop+down+menu+tutorials" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/&amp;title=List+of+pure+css+drop+down+menu+tutorials" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/10/06/list-of-pure-css-drop-down-menu-tutorials/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free IP address geolocation tool</title>
		<link>http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/</link>
		<comments>http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 04:18:30 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[web tool]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=213</guid>
		<description><![CDATA[If you are looking for geographical location of an IP address, I would like to recommend you to use IPInfoDB .
This is the free web tool that you can detect geographical location of an IP address.

IP Info DB is offering free services based on their IP address geolocation database.

 Web based IP geolocation lookup
IP geolocation [...]]]></description>
			<content:encoded><![CDATA[<p>If you are looking for geographical location of an IP address, I would like to recommend you to use <a href="http://ipinfodb.com" target="_blank">IPInfoDB</a> .<br />
This is the free web tool that you can detect geographical location of an IP address.</p>
<blockquote>
<h3>IP Info DB is offering free services based on their IP address geolocation database.</h3>
<ul>
<li> Web based IP geolocation lookup</li>
<li>IP geolocation API (XML, JSON and CSV format)</li>
<li>API that generate IP CIDR by country for iptables or htaccess blocklist</li>
<li>E-commerce fraud detection API</li>
<li>Free version of our SQL database updated monthly!</li>
</ul>
</blockquote>
<p><a href="http://ipinfodb.com"><img class="aligncenter size-full wp-image-214" title="IPInfoDB" src="http://www.thetechspace.com/wp-content/uploads/2009/10/ipinfodb.jpg" alt="IPInfoDB" width="615" height="250" /></a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://delicious.com/post?url=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;title=Free+IP+address+geolocation+tool" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;title=Free+IP+address+geolocation+tool" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;title=Free+IP+address+geolocation+tool" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;t=Free+IP+address+geolocation+tool" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Free+IP+address+geolocation+tool+-+http://tinyurl.com/ydtgtcc+(via+@lit_tiger)&amp;source=shareaholic" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;title=Free+IP+address+geolocation+tool" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;imageurl=" rel="" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/&amp;title=Free+IP+address+geolocation+tool" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/10/04/free-ip-address-geolocation-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
