<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>InTechgrity</title>
	
	<link>http://www.intechgrity.com</link>
	<description>Web Development, jQuery, PHP-MySQL, AJAX, CSS, Technology and ...</description>
	<lastBuildDate>Sun, 29 Jan 2012 13:39:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/greentechspot" /><feedburner:info uri="greentechspot" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-nd/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId>greentechspot</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Get post count of a category including sub-categories in WordPress</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/29Fvuo87ZoU/</link>
		<comments>http://www.intechgrity.com/get-post-count-of-a-category-including-sub-categories-in-wordpress/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 13:39:46 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[wordpress api]]></category>
		<category><![CDATA[wordpress hacks]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=974</guid>
		<description><![CDATA[From the title, you probably have guessed what I am going to talk about. In WordPress, we have many APIs to list down the category, but when we use the get_category function, it lacks the ability to show the post counts from its sub or child categories. Whereas, when we use query_posts or get_posts to [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/properly-add-pagination-to-your-wordpress-plugin/' rel='bookmark' title='Properly add pagination to your WordPress Plugin'>Properly add pagination to your WordPress Plugin</a></li>
<li><a href='http://www.intechgrity.com/add-archive-page-wordpress-blog-custom-page-template/' rel='bookmark' title='Howto: Add an Archive Page to your WordPress blog using Custom Page Template'>Howto: Add an Archive Page to your WordPress blog using Custom Page Template</a></li>
<li><a href='http://www.intechgrity.com/add-dynamic-login-logout-n-site-admin-button-to-wordpress-using-wp-api/' rel='bookmark' title='Add dynamic Login Logout n Site Admin button to WordPress using WP API'>Add dynamic Login Logout n Site Admin button to WordPress using WP API</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/mW6HuDCPPQqZA6GiSeZnyAuIJxQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/mW6HuDCPPQqZA6GiSeZnyAuIJxQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mW6HuDCPPQqZA6GiSeZnyAuIJxQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/mW6HuDCPPQqZA6GiSeZnyAuIJxQ/1/di" border="0" ismap="true"></img></a></p><p><script type="text/javascript"><!--
google_ad_client = "pub-0754742552504690";
/* iTg WP - Above Post336x280, created 7/28/10 */
google_ad_slot = "5702344208";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<div class="clear"></div></p><p><img class="aligncenter size-full wp-image-975" title="Get post count of a category with child" src="http://www.intechgrity.com/wp-content/uploads/2012/01/get-post-count-from-cat-with-child.png" alt="get-post-count-from-cat-with-child" width="500" height="300" />From the title, you probably have guessed what I am going to talk about. In WordPress, we have many APIs to list down the category, but when we use the get_category function, it lacks the ability to show the post counts from its sub or child categories. Whereas, when we use <span class="code">query_posts</span> or <span class="code">get_posts</span> to get posts from a particular category, it returns posts from child categories as well.</p>
<p>I faced this problem, while developing the 2nd version of the <a title="WP Category Post List Plugin – List your posts filtered by categories with thumbnails" href="http://www.intechgrity.com/wp-category-post-list-plugin-list-your-posts-filtered-by-categories-with-thumbnails/" target="_blank">WP-CPL</a> plugin. So I came up with a custom function which will return total post counts from the specified category and its child categories (if any).</p>
<p>Here are the codes and the usage instruction.</p>
<h2>The Custom Function:</h2>
<pre class="brush: php; title: ; notranslate">
function wp_get_cat_postcount($id) {
	$cat = get_category($id);
	$count = (int) $cat-&gt;count;
	$taxonomy = 'category';
	$args = array(
	  'child_of' =&gt; $id,
	);
	$tax_terms = get_terms($taxonomy,$args);
	foreach ($tax_terms as $tax_term) {
		$count +=$tax_term-&gt;count;
	}
	return $count;
}
</pre>
<h2>Usage Guide:</h2>
<p>The usage of this function is pretty straight forward. You call the function whenever you need passing the category id. Say, the category ID is 2. You call it with something like this:</p>
<pre class="brush: php; title: ; notranslate">
The total number of posts under &quot;My Awesome Category&quot; is &lt;?php echo wp_get_cat_postcount(2); ?&gt;
</pre>
<p>Well, that&#8217;s all. Short and informative. If you have any questions, be sure to drop in using comments.</p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/properly-add-pagination-to-your-wordpress-plugin/' rel='bookmark' title='Properly add pagination to your WordPress Plugin'>Properly add pagination to your WordPress Plugin</a></li>
<li><a href='http://www.intechgrity.com/add-archive-page-wordpress-blog-custom-page-template/' rel='bookmark' title='Howto: Add an Archive Page to your WordPress blog using Custom Page Template'>Howto: Add an Archive Page to your WordPress blog using Custom Page Template</a></li>
<li><a href='http://www.intechgrity.com/add-dynamic-login-logout-n-site-admin-button-to-wordpress-using-wp-api/' rel='bookmark' title='Add dynamic Login Logout n Site Admin button to WordPress using WP API'>Add dynamic Login Logout n Site Admin button to WordPress using WP API</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=29Fvuo87ZoU:mSjQAEh3ZCE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=29Fvuo87ZoU:mSjQAEh3ZCE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=29Fvuo87ZoU:mSjQAEh3ZCE:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=29Fvuo87ZoU:mSjQAEh3ZCE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=29Fvuo87ZoU:mSjQAEh3ZCE:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=29Fvuo87ZoU:mSjQAEh3ZCE:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/29Fvuo87ZoU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/get-post-count-of-a-category-including-sub-categories-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/get-post-count-of-a-category-including-sub-categories-in-wordpress/</feedburner:origLink></item>
		<item>
		<title>MySQL: Working with date time arithmetic #Part 2.3.1</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/6iiR30Apuo0/</link>
		<comments>http://www.intechgrity.com/mysql-working-with-date-time-arithmetic-part-2-3-1/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 13:49:31 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-datetime]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=942</guid>
		<description><![CDATA[So, this is the second last part of the long awaited MySQL datetime series. Previously we have leant how to work with MySQL datetime datatypes and how to automate some insertions using some MySQL datetime commands. Obviously the only thing left to discuss is, the (difficult) datetime arithmetic inside MySQL. As in any language, the [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/automatically-insert-current-date-and/' rel='bookmark' title='Automatically insert Current Date and Time in MySQL table #Part – 2.2'>Automatically insert Current Date and Time in MySQL table #Part – 2.2</a></li>
<li><a href='http://www.intechgrity.com/mysql-date-and-time-datatypes-overview/' rel='bookmark' title='MySQL date and time DataTypes Overview: DATE, TIME, DATETIME, TIMESTAMP, YEAR &amp; Zero Values #Part2.1'>MySQL date and time DataTypes Overview: DATE, TIME, DATETIME, TIMESTAMP, YEAR &amp; Zero Values #Part2.1</a></li>
<li><a href='http://www.intechgrity.com/mysql-datatypes-working-with-fraction-and-decimal-dec/' rel='bookmark' title='MySQL datatypes: working with fraction and decimal [DEC]'>MySQL datatypes: working with fraction and decimal [DEC]</a></li>
<li><a href='http://www.intechgrity.com/mysql-data-types-char-varchar-int-text/' rel='bookmark' title='MySQL data types: CHAR, VARCHAR, INT, TEXT #Part-1'>MySQL data types: CHAR, VARCHAR, INT, TEXT #Part-1</a></li>
<li><a href='http://www.intechgrity.com/create-login-admin-logout-page-in-php-w/' rel='bookmark' title='Create Login Admin &amp; Logout Page in PHP w/ SESSION n MySQL'>Create Login Admin &amp; Logout Page in PHP w/ SESSION n MySQL</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/cw2acEin59z1DmGaGauOf5u3M4s/0/da"><img src="http://feedads.g.doubleclick.net/~a/cw2acEin59z1DmGaGauOf5u3M4s/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cw2acEin59z1DmGaGauOf5u3M4s/1/da"><img src="http://feedads.g.doubleclick.net/~a/cw2acEin59z1DmGaGauOf5u3M4s/1/di" border="0" ismap="true"></img></a></p><p>So, this is the second last part of the long awaited MySQL datetime series. Previously we have leant how to work with MySQL datetime datatypes and how to automate some insertions using some MySQL datetime commands. Obviously the only thing left to discuss is, the (difficult) datetime arithmetic inside MySQL. As in any language, the datetime arithmetic is not as straight forward as normal arithmetic. The reason is simple, we can&#8217;t say 2+2=4 while dealing with dates <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p style="text-align: center;"><img class="aligncenter" title="MySQL Datetime Arithmetic" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-datetime-arithmetic.png" alt="" width="500" height="300" /></p>
<p style="text-align: justify;">Suppose we have a date, &#8217;2004-02-28&#8242; in YYYY-MM-DD format (which is, a default datetime format for MySQL) and we want to add one more day to the date. So, the result is (supposedly) &#8217;2004-03-01&#8242;. But wait, 2004 is a leap year, so it should be &#8217;2004-02-29&#8242;, right?</p>
<p style="text-align: justify;">These are only a few of the difficulties we face while dealing with datetime arithmetic. Luckily, like any efficient programming language, MySQL (although it is a structured query language) has it&#8217;s own set of functions to deal with all these datetime stuffs. Now let us see how we can effectively use those functions to do all our datetime stuffs with queries. But before we start, I would recommend you to go through these two posts related to MySQL:</p>
<ol>
<li><a href="http://www.intechgrity.com/mysql-date-and-time-datatypes-overview/">MySQL date, time and datetime datatype overview</a></li>
<li><a href="http://www.intechgrity.com/automatically-insert-current-date-and/">Automatically insert date and time in MySQL tables</a></li>
</ol>
<p>Done? Okay, now let us move into further details. In this tutorial we will discuss only the basic and primary arithmetic. In 90% of the cases we will need only these concepts to get our jobs done. Please note that <em>we will show nesting only with default current datetime mysql functions</em>. <em><strong>The nesting is done basically depending on the format of the argument of the main function and format of the return of the nested function</strong></em>.</p>
<h2>#1: The basic date time arithmetic in MySQL</h2>
<p>To learn the basic arithmetic calculations, we need to learn three (basically two) date/time functions</p>
<ul>
<li>DATE_ADD</li>
<li>DATE_SUB</li>
<li>ADDTIME</li>
<li>SUBTIME</li>
</ul>
<h3>#1.1: DATE_ADD &#8211; adds INTERVALS to date:</h3>
<p><span class="spanlight">DATE_ADD</span>, as the name suggests, adds specified interval to the provided date. The syntax and usage is given below.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">DATE_ADD('YYYY-MM-DD HH:mm:SS', INTERVAL &lt;expr&gt; &lt;UNIT&gt;)</pre>
<p>So, it passes two arguments.</p>
<ul>
<li>The first argument is the <span class="code">YYYY-MM-DD HH:mm:SS</span> format. We can ignore the <span class="code">HH:mm:SS</span> and use only <span class="code">YYYY-MM-DD</span> in case we want only date related calculations.</li>
<li>The second argument passes the <span class="code">INTERVAL</span>which is to be added with the proper value. The expressions are
<ul>
<li>expr: The positive or negative integer which to be added to the mentioned date</li>
<li>UNIT: The unit of the expr. This can be day, month, hour, minute, second and so on. A detailed instruction is found on the table below.</li>
</ul>
</li>
</ul>
<table class="css3table">
<thead>
<tr>
<th scope="col"> UNIT</th>
<th scope="col">EXPR</th>
<th scope="col">Example</th>
</tr>
</thead>
<tbody>
<tr>
<td> <code>MICROSECOND</code></td>
<td>Microseconds<code></code></td>
<td> INTERVAL 100 MICROSECOND</td>
</tr>
<tr>
<td> <code>SECOND</code></td>
<td>Seconds</td>
<td> INTERVAL -5 SECOND</td>
</tr>
<tr>
<td> <code>MINUTE</code></td>
<td>Minutes</td>
<td> INTERVAL 30 MINUTE</td>
</tr>
<tr>
<td> <code>HOUR</code></td>
<td>Hours</td>
<td> INTERVAL 2 HOUR</td>
</tr>
<tr>
<td> <code>DAY</code></td>
<td>Days</td>
<td> INTERVAL 5 DAY</td>
</tr>
<tr>
<td> <code>WEEK</code></td>
<td>Weeks</td>
<td> INTERVAL 2 WEEK</td>
</tr>
<tr>
<td> <code>MONTH</code></td>
<td>Months</td>
<td> INTERVAL 4 MONTH</td>
</tr>
<tr>
<td> <code>YEAR</code></td>
<td>Years</td>
<td> INTERVAL 2 YEAR</td>
</tr>
</tbody>
</table>
<p>Those were only a few. More detailed list of Unit vs Expr can be found <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add" target="_blank">here</a>.</p>
<h4>Nesting:</h4>
<p>The above function can also be nested with proper <a title="Automatically insert Current Date and Time in MySQL table #Part – 2.2" href="http://www.intechgrity.com/automatically-insert-current-date-and/" target="_blank">MySQL datetime functions</a>. For example, <span class="spanlight">CURDATE()</span> or <span class="spanlight">NOW()</span> can be passed into the first argument.</p>
<h4>Examples:</h4>
<p>Here are some direct usage of DATE_ADD using SELECT query:</p>
<pre class="brush: sql; title: ; notranslate">SELECT DATE_ADD('2004-02-28', INTERVAL 1 DAY) AS leap_year;
SELECT DATE_ADD(CURDATE(), INTERVAL 1 YEAR) AS day_next_year;
SELECT YEAR(DATE_ADD(CURDATE(), INTERVAL 101 YEAR)) AS next_101_year; --Extracts the year from the date_add arithmetic
SELECT DATE_ADD(NOW(), INTERVAL 30 MINUTE) AS time_next_half_hour;</pre>
<p>The output is shown below</p>
<div id="attachment_947" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-date_add-examples1.png"><img class="size-medium wp-image-947" title="mysql-date_add-examples" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-date_add-examples1-300x204.png" alt="MySQL DATE_ADD Examples" width="300" height="204" /></a><p class="wp-caption-text">MySQL DATE_ADD Examples</p></div>
<h3>#1.2: DATE_SUB &#8211; subtracts INTERVAL from date:</h3>
<p>Theoretically, it does the same job as DATE_ADD with negative interval. So the following codes are similar</p>
<pre class="brush: sql; title: ; notranslate">--So the code
SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY);
--is equivalent to
SELECT DATE_ADD(CURDATE(), INTERVAL -1 DAY);</pre>
<p>It has the same synopsis (syntax) and expressions as <span class="spanlight">DATE_ADD</span>. The output of the above query is shown below.</p>
<div id="attachment_948" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/date_add-vs-date_sub-mysql.png"><img class="size-medium wp-image-948" title="DATE_ADD vs DATE_SUB in MySQL" src="http://www.intechgrity.com/wp-content/uploads/2011/12/date_add-vs-date_sub-mysql-300x156.png" alt="DATE_ADD vs DATE_SUB in MySQL" width="300" height="156" /></a><p class="wp-caption-text">DATE_ADD vs DATE_SUB in MySQL</p></div>
<h3> #1.3: ADDTIME() and SUBTIME() to work only with time:</h3>
<p>As the names suggest, ADDTIME() is used for adding time to a specified time and SUBTIME() is used for subtracting time from a specified time. Here are in depth details.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ADDTIME synopsis; notranslate">ADDTIME(&lt;expr1&gt;, &lt;expr2&gt;);</pre>
<pre class="brush: sql; title: SUBTIME synopsis; notranslate">SUBTIME(&lt;expr1&gt;, &lt;expr2&gt;);</pre>
<ul>
<li><strong><em>expr1, expr2 </em></strong>are both in <span class="code">HH:mm:SS</span> format.</li>
<li>ADDTIME adds expr2 to expr1 and returns the result.</li>
<li>SUBTIME subtracts expr2 from expr1 and returns the result.</li>
</ul>
<h4>Nesting:</h4>
<p>This can be nested with time returning functions such as <span class="spanlight">CURTIME()</span>.</p>
<h4>Examples:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT ADDTIME('12:00:01', '00:30:59');
SELECT SUBTIME('12:59:03', '00:09:04');
SELECT ADDTIME(CURTIME(), '14:00:00');</pre>
<p>The output is shown below</p>
<div id="attachment_949" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-addtime-and-subtime.png"><img class="size-medium wp-image-949" title="MySQL ADDTIME and SUBTIME" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-addtime-and-subtime-300x156.png" alt="MySQL ADDTIME and SUBTIME" width="300" height="156" /></a><p class="wp-caption-text">MySQL ADDTIME and SUBTIME</p></div>
<h2> #2: Advance date-time arithmetic functions:</h2>
<p>Now that we are familiar with the basics, let us now see, some advanced functions which will become handy in real world projects. Here we are going to discuss the following functions</p>
<ul>
<li>DATEDIFF</li>
<li>TIMEDIFF</li>
<li>LASTDAY</li>
<li>EXTRACT</li>
<li>MAKEDATE</li>
<li>MAKETIME</li>
</ul>
<h3>#2.1: DATEDIFF &#8211; calculates days between two dates:</h3>
<p>The difference between <span class="spanlight">DATEDIFF</span> and <span class="spanlight">DATE_SUB</span> is that, <span class="spanlight">DATEDIFF</span> returns the number of days between two dates. It can be either positive or negative.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">DATEDIFF(&lt;expr1&gt;, &lt;expr2&gt;)</pre>
<ul>
<li><strong><em>expr1, expr2</em></strong> can be either <span class="code">YYYY-MM-DD HH:mm:SS</span> or <span class="code">YYYY-MM-DD</span>. Only <span class="code">YYYY-MM-DD</span> will be used for the calculation</li>
<li>It returns <strong><em>expr1 &#8211; expr2</em></strong> in number of <strong>days</strong>.</li>
</ul>
<h4>Nesting:</h4>
<p>Due to the format of the arguments it supports, <span class="spanlight">CURDATE()</span> and <span class="spanlight">NOW()</span> can be nested.</p>
<h4>Example:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT DATEDIFF('2010-12-31', '2011-01-01');
SELECT DATEDIFF('2011-12-31', '2010-01-01');
SELECT DATEDIFF('2011-12-21', '2011-12-30');
SELECT DATEDIFF(DATE_ADD(CURDATE(), INTERVAL 1 MONTH), CURDATE());</pre>
<p>The output is</p>
<div id="attachment_950" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-datediff.png"><img class="size-medium wp-image-950" title="MySQL DATEDIFF" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-datediff-300x199.png" alt="MySQL DATEDIFF" width="300" height="199" /></a><p class="wp-caption-text">Working with MySQL DATEDIFF</p></div>
<h4 class="faq">Food for thought:</h4>
<p>Note how the last query can be used to get the number of days in the upcoming month. Now try and think how we can use similar query to get the number of days in upcoming year.</p>
<div class='et-learn-more clearfix'>
					<h3 class='heading-more'><span>Want to check the answer?</span></h3>
					<div class='learn-more-content'><pre class="brush: sql; title: ; notranslate">SELECT DATEDIFF(DATE_ADD(NOW(), INTERVAL 1 YEAR), NOW());</pre>
<p>CURDATE could also be used, instead of NOW</div>
				</div>
<h3>#2.2: TIMEDIFF &#8211; calculates HH:mm:SS b/w two times:</h3>
<p>This is pretty straight forward. It takes two arguments in time format, subtracts and returns the result.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">TIMEDIFF(&lt;expr1&gt;, &lt;expr2&gt;)</pre>
<ul>
<li><strong><em>expr1, expr2</em></strong> is of the format <span class="code">HH:mm:SS</span></li>
<li>It returns <strong><em>expr1 &#8211; expr2</em></strong> as time value in <span class="code">HH:mm:SS</span> format.</li>
</ul>
<h4>Nesting:</h4>
<p>It can be nested with <span class="spanlight">CURTIME()</span> function. We will see this in the examples.</p>
<h4>Examples:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT TIMEDIFF('24:12:01', '12:12:00');
SELECT TIMEDIFF(CURTIME(), '00:30:00');</pre>
<p>The output is shown below.</p>
<div id="attachment_951" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-timediff.png"><img class="size-medium wp-image-951" title="Using MySQL TIMEDIFF" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-timediff-300x114.png" alt="Using MySQL TIMEDIFF" width="300" height="114" /></a><p class="wp-caption-text">Using MySQL TIMEDIFF</p></div>
<h3>#2.3: LAST_DAY &#8211; of specified month of date:</h3>
<p>This returns the last day date of the year-month-day passed in the argument.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">LAST_DAY(&lt;date&gt;)</pre>
<ul>
<li><strong><em>date</em></strong> is the <span class="code">YYYY-MM-DD</span> value passed.</li>
<li>It returns a <span class="code">YYYY-MM-DD</span> which corresponds to the last day of the month of the year.</li>
</ul>
<h4>Nesting:</h4>
<p>As obvious, it can be nested with <span class="spanlight">CURDATE()</span> function.</p>
<h4>Examples:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT LAST_DAY('2012-02-01');
SELECT LAST_DAY(CURDATE());</pre>
<p>The output is</p>
<div id="attachment_952" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-last_day.png"><img class="size-medium wp-image-952" title="Using MySQL LAST_DAY" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-last_day-300x109.png" alt="Using MySQL LAST_DAY" width="300" height="109" /></a><p class="wp-caption-text">Using MySQL LAST_DAY</p></div>
<h3>#2.4: EXTRACT &#8211; what you need from date/time stamp:</h3>
<p>This allows extracting a specific part of the datetime from the passed argument.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">EXTRACT(&lt;unit&gt; FROM &lt;date&gt;)</pre>
<ul>
<li>The <em><strong>unit</strong></em> is same as <span class="spanlight">DATE_ADD()</span>.</li>
<li>The <strong><em>date </em></strong>can be
<ul>
<li>Complete <span class="code">YYYY-MM-DD HH:mm:SS</span></li>
<li>Just <em>date</em> format as <span class="code">YYYY-MM-DD</span></li>
<li>Just <em>time</em> format as <span class="code">HH:mm:SS</span></li>
</ul>
</li>
</ul>
<p>It returns just the expression for the specified unit.</p>
<h4>Nesting:</h4>
<p>Because of the flexibility, it can be nested with all the date time functions as <span class="spanlight">NOW()</span>, <span class="spanlight">CURDATE()</span>, <span class="spanlight">CURTIME()</span> etc.</p>
<h4>Examples:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT EXTRACT(MONTH FROM '2011-02-28');
SELECT EXTRACT(DAY FROM LAST_DAY('2012-02-01')); --effective eh?
SELECT EXTRACT(DAY FROM DATE_ADD(CURDATE(), INTERVAL 20 DAY)); --even more complex
SELECT EXTRACT(HOUR FROM CURTIME()); --Works with HH:mm:SS too</pre>
<p>The outputs are</p>
<div id="attachment_953" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/using-mysql-extract.png"><img class="size-medium wp-image-953" title="Using MySQL EXTRACT" src="http://www.intechgrity.com/wp-content/uploads/2011/12/using-mysql-extract-300x199.png" alt="Using MySQL EXTRACT" width="300" height="199" /></a><p class="wp-caption-text">Using MySQL EXTRACT</p></div>
<h3>#2.5: MAKEDATE &#8211; from year and day:</h3>
<p>It constructs a date when the year and day of the year is given.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">MAKEDATE(&lt;year&gt;, &lt;day_of_year&gt;)</pre>
<ul>
<li>The <strong><em>year</em></strong> is the year of which the date is to be calculated.</li>
<li>The <strong><em>day_of_year</em></strong> is the count of the day from the beginning.</li>
<li>It returns a date in <span class="code">YYYY-MM-DD</span> format.</li>
</ul>
<h4>Nesting:</h4>
<p>Due to the format of the input arguments, it can not be nested directly with any MySQL current datetime functions.</p>
<h4>Examples:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT MAKEDATE(2012, 365);
SELECT MAKEDATE(2010, DATEDIFF(CURDATE(), '2011-04-12'));
SELECT MAKEDATE(2000, DATEDIFF(CURDATE(), '2000-01-01'));
SELECT MAKEDATE(2000, DATEDIFF(DATE_ADD(CURDATE(), INTERVAL 1 DAY), '2000-01-01')) AS today;</pre>
<p>The output is</p>
<div id="attachment_954" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-makedate.png"><img class="size-medium wp-image-954" title="Using MySQL MAKEDATE" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-makedate-300x204.png" alt="Using MySQL MAKEDATE" width="300" height="204" /></a><p class="wp-caption-text">Using MySQL MAKEDATE</p></div>
<h4 class="faq">Food for thought:</h4>
<p>Note how the last query gives today&#8217;s date. Can you think further to give same date for the next year? As in, today&#8217;s date is 2011-12-19. Can you print 2012-12-19 in similar approach?</p>
<div class='et-learn-more clearfix'>
					<h3 class='heading-more'><span>Want to check the answer?</span></h3>
					<div class='learn-more-content'><pre class="brush: sql; title: ; notranslate">SELECT MAKEDATE(2001, DATEDIFF(DATE_ADD(CURDATE(), INTERVAL 1 DAY), '2000-01-01')) AS next_year_today;</pre>
<p>Easy right? We just took the difference from the same year and constructed from one more year (2001).</div>
				</div>
<h3>#2.6: MAKETIME &#8211; from HH, mm &amp; SS:</h3>
<p>This is very simple, yet useful function. It constructs a Time format from the given arguments.</p>
<h4>Syntax:</h4>
<pre class="brush: sql; title: ; notranslate">MAKETIME(&lt;hour&gt;, &lt;minute&gt;, &lt;second&gt;)</pre>
<ul>
<li>The <em><strong>hour, minute, second</strong></em>arguments can hold only the legal values
<ul>
<li>0-59 for <em><strong>minute, second</strong></em></li>
</ul>
</li>
</ul>
<p>It returns a nicely formatted <span class="code">HH:mm:SS</span> value from the arguments.</p>
<h4>Nesting:</h4>
<p>Due to it&#8217;s format, it can not be nested with current datetime mysql functions.</p>
<h4>Examples:</h4>
<pre class="brush: sql; title: ; notranslate">SELECT MAKETIME(12, 34, 11);
SELECT MAKETIME(12, EXTRACT(MINUTE FROM CURTIME()), 59);</pre>
<p>The outputs are</p>
<div id="attachment_956" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-maketime.png"><img class="size-medium wp-image-956" title="Using MySQL MAKETIME" src="http://www.intechgrity.com/wp-content/uploads/2011/12/mysql-maketime-300x114.png" alt="Using MySQL MAKETIME" width="300" height="114" /></a><p class="wp-caption-text">Using MySQL MAKETIME</p></div>
<p>So that was all. Hope it will help you understand better the concept of MySQL datetime arithmetic. <em>If you have any doubt, just throw in using the comments form</em>. In the next tutorial, we will see how to use these functions in real world using a MySQL table. You can also check the <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html" target="_blank">official MySQL documentation</a> for more available datetime functions. Oh, and here is a downloadable SQL file for your ease!</p>
<div class="demo-download lonely"><a class="download" title="MySQL datetime arithmetic functions Downloaded 22" href="http://www.intechgrity.com/downloads/12">Download Now</a></div>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/automatically-insert-current-date-and/' rel='bookmark' title='Automatically insert Current Date and Time in MySQL table #Part – 2.2'>Automatically insert Current Date and Time in MySQL table #Part – 2.2</a></li>
<li><a href='http://www.intechgrity.com/mysql-date-and-time-datatypes-overview/' rel='bookmark' title='MySQL date and time DataTypes Overview: DATE, TIME, DATETIME, TIMESTAMP, YEAR &amp; Zero Values #Part2.1'>MySQL date and time DataTypes Overview: DATE, TIME, DATETIME, TIMESTAMP, YEAR &amp; Zero Values #Part2.1</a></li>
<li><a href='http://www.intechgrity.com/mysql-datatypes-working-with-fraction-and-decimal-dec/' rel='bookmark' title='MySQL datatypes: working with fraction and decimal [DEC]'>MySQL datatypes: working with fraction and decimal [DEC]</a></li>
<li><a href='http://www.intechgrity.com/mysql-data-types-char-varchar-int-text/' rel='bookmark' title='MySQL data types: CHAR, VARCHAR, INT, TEXT #Part-1'>MySQL data types: CHAR, VARCHAR, INT, TEXT #Part-1</a></li>
<li><a href='http://www.intechgrity.com/create-login-admin-logout-page-in-php-w/' rel='bookmark' title='Create Login Admin &amp; Logout Page in PHP w/ SESSION n MySQL'>Create Login Admin &amp; Logout Page in PHP w/ SESSION n MySQL</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=6iiR30Apuo0:D6LMwtPwpC4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=6iiR30Apuo0:D6LMwtPwpC4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=6iiR30Apuo0:D6LMwtPwpC4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=6iiR30Apuo0:D6LMwtPwpC4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=6iiR30Apuo0:D6LMwtPwpC4:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=6iiR30Apuo0:D6LMwtPwpC4:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/6iiR30Apuo0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/mysql-working-with-date-time-arithmetic-part-2-3-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/mysql-working-with-date-time-arithmetic-part-2-3-1/</feedburner:origLink></item>
		<item>
		<title>C Program: Replacing a substring from a string</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/tXVd7WLrhe0/</link>
		<comments>http://www.intechgrity.com/c-program-replacing-a-substring-from-a-string/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 05:31:06 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[C & C++ Sample Prorgams]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[c-strcpy]]></category>
		<category><![CDATA[c-strlen]]></category>
		<category><![CDATA[c-strstr]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=929</guid>
		<description><![CDATA[This is a nice piece of program I wrote a few months ago. One of my students requested me to write this. So, here it is! Hope this might be useful for you&#8230; #1: What the program does: This program finds all the occurrences of a sub-string within a given string and replaces that with [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/c-program-adding-two-polynomials-using-linked-list/' rel='bookmark' title='C Program: Adding two polynomials using Linked List'>C Program: Adding two polynomials using Linked List</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/ZiwNqg4g9KIQxMO02FUwA2_1UfU/0/da"><img src="http://feedads.g.doubleclick.net/~a/ZiwNqg4g9KIQxMO02FUwA2_1UfU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ZiwNqg4g9KIQxMO02FUwA2_1UfU/1/da"><img src="http://feedads.g.doubleclick.net/~a/ZiwNqg4g9KIQxMO02FUwA2_1UfU/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/c-prog-new.png"><img class="aligncenter size-full wp-image-930" title="c-prog-new" src="http://www.intechgrity.com/wp-content/uploads/2011/12/c-prog-new.png" alt="" width="450" height="277" /></a>This is a nice piece of program I wrote a few months ago. One of my students requested me to write this. So, here it is! Hope this might be useful for you&#8230;</p>
<h2>#1: What the program does:</h2>
<p>This program finds all the occurrences of a sub-string within a given string and replaces that with our provided string. Basically there are many similar programs but, most of them lack the ability to find multiple occurrences. So I wrote this keeping in mind that the search string may appear many times in the original string. Here is the algo:</p>
<ul>
<li>Get the original, search and replace string from the user.</li>
<li>Write a user defined function to replace the first occurrence of the search string with the replace string.</li>
<li>Recursively call the function until there is no occurrence of the search string.</li>
</ul>
<p>Yes, there are many flaws in this program, like if the search string is a part of the replace string, the function will fail. I will try to remove these bugs when I get enough time. But this program will do the job for you in your college semesters <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>#2: Source Code:</h2>
<pre class="brush: cpp; title: String replace program in C; notranslate">
/**
 ****************************************************|
 * String replace Program                            |
 ****************************************************|
 * Takes three string input from the user
 * Replaces all the occurances of the second string
 * with the third string from the first string
 * @author Swashata
 */

/** Include Libraries */
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;

/** Define the max char length */
#define MAX_L 4096

/** Prototypes */
void replace (char *, char *, char *);

int main(void) {
    char o_string[MAX_L], s_string[MAX_L], r_string[MAX_L]; //String storing variables

	printf(&quot;Please enter the original string (max length %d characters): &quot;, MAX_L);
	fflush(stdin);
	gets(o_string);

	printf(&quot;\nPlease enter the string to search (max length %d characters): &quot;, MAX_L);
	fflush(stdin);
	gets(s_string);

	printf(&quot;\nPlease enter the replace string (max length %d characters): &quot;, MAX_L);
	fflush(stdin);
	gets(r_string);

	printf(&quot;\n\nThe Original string\n*************************************\n&quot;);
	puts(o_string);

	replace(o_string, s_string, r_string);

	printf(&quot;\n\nThe replaced string\n*************************************\n&quot;);
	puts(o_string);

    return 0;
}

/**
 * The replace function
 *
 * Searches all of the occurrences using recursion
 * and replaces with the given string
 * @param char * o_string The original string
 * @param char * s_string The string to search for
 * @param char * r_string The replace string
 * @return void The o_string passed is modified
 */
void replace(char * o_string, char * s_string, char * r_string) {
      //a buffer variable to do all replace things
      char buffer[MAX_L];
      //to store the pointer returned from strstr
      char * ch;

      //first exit condition
      if(!(ch = strstr(o_string, s_string)))
              return;

      //copy all the content to buffer before the first occurrence of the search string
      strncpy(buffer, o_string, ch-o_string);

      //prepare the buffer for appending by adding a null to the end of it
      buffer[ch-o_string] = 0;

      //append using sprintf function
      sprintf(buffer+(ch - o_string), &quot;%s%s&quot;, r_string, ch + strlen(s_string));

      //empty o_string for copying
      o_string[0] = 0;
      strcpy(o_string, buffer);
      //pass recursively to replace other occurrences
      return replace(o_string, s_string, r_string);
 }
</pre>
<h2>#3: Output:</h2>
<div id="attachment_931" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/12/string-replace-c-output.png"><img class="size-medium wp-image-931" title="string-replace-c-output" src="http://www.intechgrity.com/wp-content/uploads/2011/12/string-replace-c-output-300x171.png" alt="" width="300" height="171" /></a><p class="wp-caption-text">String replace output</p></div>
<p>So that was it. If you have any better programming approach, then do share with us!</p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/c-program-adding-two-polynomials-using-linked-list/' rel='bookmark' title='C Program: Adding two polynomials using Linked List'>C Program: Adding two polynomials using Linked List</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=tXVd7WLrhe0:c-LOFd1ayiw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=tXVd7WLrhe0:c-LOFd1ayiw:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=tXVd7WLrhe0:c-LOFd1ayiw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=tXVd7WLrhe0:c-LOFd1ayiw:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=tXVd7WLrhe0:c-LOFd1ayiw:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=tXVd7WLrhe0:c-LOFd1ayiw:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/tXVd7WLrhe0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/c-program-replacing-a-substring-from-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/c-program-replacing-a-substring-from-a-string/</feedburner:origLink></item>
		<item>
		<title>C Program: Adding two polynomials using Linked List</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/FZEiZNFkIAs/</link>
		<comments>http://www.intechgrity.com/c-program-adding-two-polynomials-using-linked-list/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 06:26:13 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[C & C++ Sample Prorgams]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[linked list]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=915</guid>
		<description><![CDATA[So, this is our first C program in the blog. We first thought of creating a separate blog for C &#38; C++ related posts, but because of the maintenance issue, we finally decided to merge it to the main blog. So, without any further here is the program. #1: What the program does: This program [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/c-program-replacing-a-substring-from-a-string/' rel='bookmark' title='C Program: Replacing a substring from a string'>C Program: Replacing a substring from a string</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/crytlLZVoaLX-9-pNUmzrHnhJ8k/0/da"><img src="http://feedads.g.doubleclick.net/~a/crytlLZVoaLX-9-pNUmzrHnhJ8k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/crytlLZVoaLX-9-pNUmzrHnhJ8k/1/da"><img src="http://feedads.g.doubleclick.net/~a/crytlLZVoaLX-9-pNUmzrHnhJ8k/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/c-prog.png"><img class="aligncenter size-medium wp-image-919" title="c-prog" src="http://www.intechgrity.com/wp-content/uploads/2011/11/c-prog-300x182.png" alt="" width="300" height="182" /></a></p>
<p>So, this is our first C program in the blog. We first thought of creating a separate blog for C &amp; C++ related posts, but because of the maintenance issue, we finally decided to merge it to the main blog. So, without any further here is the program.</p>
<h2>#1: What the program does:</h2>
<p>This program is a practical implementation of the data structure &#8220;<strong>Linked List</strong>&#8220;. We use a linked list to dynamically store user input of polynomial expressions and then we add two polynomials using some simple arithmetic. For this, we follow the simple strategy:</p>
<ul>
<li>Make a polynomial abstract datatype using <em><strong>struct</strong></em> which basically implements a linked list.</li>
<li>We write different functions for Creating (ie, adding more nodes to the linked list) a polynomial function, Adding two polynomials and Showing a polynomial expression.</li>
<li>Finally we write the main function with menu driven ability to add as many pairs of polynomials the user wants.</li>
</ul>
<h2>#2: Source Code:</h2>
<pre class="brush: cpp; tab-size: 4; title: Adding two polynomials using Linked List; notranslate">
/**
 * Add two polynomials
 * Using Linked List
 * @author Swashata
 * @for Dearest Froggie
 */

#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;

/**
 * The structure for the polynomial
 * This is a linked list with two variable
 * int coeff The Coefficient
 * int pow The power of x
 */
typedef struct link {
	int coeff;
	int pow;
	struct link * next;
} my_poly;

/** The prototypes */
void my_create_poly(my_poly **);
void my_show_poly(my_poly *);
void my_add_poly(my_poly **, my_poly *, my_poly *);

/**
 * The simple menu driven main function
 */
int main(void) {
	int ch;
	do {
		my_poly * poly1, * poly2, * poly3;

		printf(&quot;\nCreate 1st expression\n&quot;);
		my_create_poly(&amp;poly1);
		printf(&quot;\nStored the 1st expression&quot;);
		my_show_poly(poly1);

		printf(&quot;\nCreate 2nd expression\n&quot;);
		my_create_poly(&amp;poly2);
		printf(&quot;\nStored the 2nd expression&quot;);
		my_show_poly(poly2);

		my_add_poly(&amp;poly3, poly1, poly2);
		my_show_poly(poly3);

		printf(&quot;\nAdd two more expressions? (Y = 1/N = 0): &quot;);
		scanf(&quot;%d&quot;, &amp;ch);
	} while (ch);
	return 0;
}

/**
 * The create polynomial function
 * @param my_poly ** node The pointer to the head of the polynomial
 * We will modify the parameter and will store the base address
 * @return void
 */
void my_create_poly(my_poly ** node) {
	int flag; //A flag to control the menu
	int coeff, pow;
	my_poly * tmp_node; //To hold the temporary last address
	tmp_node = (my_poly *) malloc(sizeof(my_poly)); //create the first node
	*node = tmp_node; //Store the head address to the reference variable
	do {
		//Get the user data
		printf(&quot;\nEnter Coeff:&quot;);
		scanf(&quot;%d&quot;, &amp;coeff);
		tmp_node-&gt;coeff = coeff;
		printf(&quot;\nEnter Pow:&quot;);
		scanf(&quot;%d&quot;, &amp;pow);
		tmp_node-&gt;pow = pow;
		//Done storing user data

		//Now increase the Linked on user condition
		tmp_node-&gt;next = NULL;

		//Ask user for continuation
		printf(&quot;\nContinue adding more terms to the polynomial list?(Y = 1/N = 0): &quot;);
		scanf(&quot;%d&quot;, &amp;flag);
		//printf(&quot;\nFLAG: %c\n&quot;, flag);
		//Grow the linked list on condition
		if(flag) {
			tmp_node-&gt;next = (my_poly *) malloc(sizeof(my_poly)); //Grow the list
			tmp_node = tmp_node-&gt;next;
			tmp_node-&gt;next = NULL;
		}
	} while (flag);
}

/**
 * The show polynomial function
 * Prints the Polynomial in user readable format
 * @param my_poly * node The polynomial linked list
 * @return void
 */
void my_show_poly(my_poly * node) {
	printf(&quot;\nThe polynomial expression is:\n&quot;);
	while(node != NULL) {
		printf(&quot;%dx^%d&quot;, node-&gt;coeff, node-&gt;pow);
		node = node-&gt;next;
		if(node != NULL)
			printf(&quot; + &quot;);
	}
}

/**
 * The polynomial add function
 * Adds two polynomial to a given variable
 * @param my_poly ** result Stores the result
 * @param my_poly * poly1 The first polynomial expression
 * @param my_poly * poly2 The second polynomial expression
 * @return void
 */
void my_add_poly(my_poly ** result, my_poly * poly1, my_poly * poly2) {
	my_poly * tmp_node; //Temporary storage for the linked list
	tmp_node = (my_poly *) malloc(sizeof(my_poly));
	tmp_node-&gt;next = NULL;
	*result = tmp_node; //Copy the head address to the result linked list

	//Loop while both of the linked lists have value
	while(poly1 &amp;&amp; poly2) {
		if (poly1-&gt;pow &gt; poly2-&gt;pow) {
			tmp_node-&gt;pow = poly1-&gt;pow;
			tmp_node-&gt;coeff = poly1-&gt;coeff;
			poly1 = poly1-&gt;next;
		}
		else if (poly1-&gt;pow &lt; poly2-&gt;pow) {
			tmp_node-&gt;pow = poly2-&gt;pow;
			tmp_node-&gt;coeff = poly2-&gt;coeff;
			poly2 = poly2-&gt;next;
		}
		else {
			tmp_node-&gt;pow = poly1-&gt;pow;
			tmp_node-&gt;coeff = poly1-&gt;coeff + poly2-&gt;coeff;
			poly1 = poly1-&gt;next;
			poly2 = poly2-&gt;next;
		}

		//Grow the linked list on condition
		if(poly1 &amp;&amp; poly2) {
			tmp_node-&gt;next = (my_poly *) malloc(sizeof(my_poly));
			tmp_node = tmp_node-&gt;next;
			tmp_node-&gt;next = NULL;
		}
	}

	//Loop while either of the linked lists has value
	while(poly1 || poly2) {
		//We have to create the list at beginning
		//As the last while loop will not create any unnecessary node
		tmp_node-&gt;next = (my_poly *) malloc(sizeof(my_poly));
		tmp_node = tmp_node-&gt;next;
		tmp_node-&gt;next = NULL;

		if(poly1) {
			tmp_node-&gt;pow = poly1-&gt;pow;
			tmp_node-&gt;coeff = poly1-&gt;coeff;
			poly1 = poly1-&gt;next;
		}
		if(poly2) {
			tmp_node-&gt;pow = poly2-&gt;pow;
			tmp_node-&gt;coeff = poly2-&gt;coeff;
			poly2 = poly2-&gt;next;
		}
	}

	printf(&quot;\nAddition Complete&quot;);
}
</pre>
<h2>#3: Output:</h2>
<div id="attachment_921" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/entering-the-first-expression.png"><img class="size-medium wp-image-921" title="entering-the-first-expression" src="http://www.intechgrity.com/wp-content/uploads/2011/11/entering-the-first-expression-300x191.png" alt="" width="300" height="191" /></a><p class="wp-caption-text">Entering the first expression</p></div>
<div id="attachment_920" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/entering-second-expression-showing-result.png"><img class="size-medium wp-image-920" title="entering-second-expression-showing-result" src="http://www.intechgrity.com/wp-content/uploads/2011/11/entering-second-expression-showing-result-300x192.png" alt="" width="300" height="192" /></a><p class="wp-caption-text">Entering second expression and showing result</p></div>
<p>So, that was all. If you think there is a better way, or have followed any other algorithm, don&#8217;t forget to drop them using comments.</p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/c-program-replacing-a-substring-from-a-string/' rel='bookmark' title='C Program: Replacing a substring from a string'>C Program: Replacing a substring from a string</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=FZEiZNFkIAs:GIQ2RYd0z00:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=FZEiZNFkIAs:GIQ2RYd0z00:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=FZEiZNFkIAs:GIQ2RYd0z00:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=FZEiZNFkIAs:GIQ2RYd0z00:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=FZEiZNFkIAs:GIQ2RYd0z00:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=FZEiZNFkIAs:GIQ2RYd0z00:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/FZEiZNFkIAs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/c-program-adding-two-polynomials-using-linked-list/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/c-program-adding-two-polynomials-using-linked-list/</feedburner:origLink></item>
		<item>
		<title>TimThumb vulerability – How it got hacked &amp; how to recover</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/9A8tDZahETI/</link>
		<comments>http://www.intechgrity.com/timthumb-vulerability-how-it-got-hacked-how-to-recover/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 11:12:45 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[timthumb]]></category>
		<category><![CDATA[vulnerability]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress hacks]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=901</guid>
		<description><![CDATA[In our last post, we talked about the fact that we got hacked because of TimThumb vulnerability. While fixing the vulnerability, I realized that, we were not the only one who got hacked. Plenty of websites using TimThumb to resize their images, got hacked. So, I thought of putting together a nice step by step [...]
No related posts.]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/pHags-0KIgWha5uh1IxSPQslJyc/0/da"><img src="http://feedads.g.doubleclick.net/~a/pHags-0KIgWha5uh1IxSPQslJyc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/pHags-0KIgWha5uh1IxSPQslJyc/1/da"><img src="http://feedads.g.doubleclick.net/~a/pHags-0KIgWha5uh1IxSPQslJyc/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/security-itg.png"><img class="alignright size-full wp-image-896" title="security-itg" src="http://www.intechgrity.com/wp-content/uploads/2011/11/security-itg.png" alt="" width="200" height="200" /></a>In our last post, we talked about the fact that we got hacked because of TimThumb vulnerability. While fixing the vulnerability, I realized that, we were not the only one who got hacked. Plenty of websites using TimThumb to resize their images, got hacked. So, I thought of putting together a nice step by step guide on how to recover from this kind of hack. Please note that, while the nature of the hack may vary, we are trying to give an overall idea on recovering. I will focus mainly on <strong>WordPress themes using timthumb</strong> but, as I had other infected sites, I will discuss about disinfecting general php files too. This topic will cover</p>
<ol>
<li>Get to know if your site is hacked</li>
<li>How the hack has occured</li>
<li>Cleaning your WordPress site</li>
<li>Cleaning your general PHP files</li>
<li>Searching the last trace of injected code using SSH</li>
</ol>
<h2>#1: Get to know if your site is hacked:</h2>
<p>If you are an experienced webmaster then you probably know whether your site is hacked or not. If not, then there is a number of ways. The best way is to check using google webmaster.</p>
<ul>
<li>If your site is registered at <a href="https://www.google.com/webmasters/tools/" target="_blank">Google Webmaster</a> then you probably have got a message related to badware activity.</li>
<li>If not then just visit <a href="http://www.stopbadware.org/home/reportsearch" target="_blank">StopBadware </a>and check to see if there is any malware activity or not.</li>
</ul>
<p>In most cases, it takes a while before Google detects malware on your site and gives you the warning. You can check even before that for any possible malwares. The common symptoms are</p>
<ul>
<li>Malicious codes like
<div class="code">&lt;script type=&#8221;text/javascript&#8221;&gt;eval&#8230;</div>
<p>on your HTML pages.</li>
<li>Malicious codes like
<div class="code">&lt;?php eval(gzuncompress(base64_decode(&#8216;eF5Tcffxd3L0CY5WjzcyN..</div>
<p>on your PHP pages.</li>
<li>Unknown advertisements being shown on your site.</li>
</ul>
<p>and etc etc&#8230;</p>
<h2>#2: How the hack has occured:</h2>
<p>In previous version of timthumb there was a vulnerability. The following sites were whitelisted by the script for <em>remote image loading and resizing</em>.</p>
<div class="code">$allowedSites = array (<br />
&#8216;flickr.com&#8217;,<br />
&#8216;picasa.com&#8217;,<br />
&#8216;blogger.com&#8217;,<br />
&#8216;wordpress.com&#8217;,<br />
&#8216;img.youtube.com&#8217;,<br />
);</div>
<p>But, the author has used the PHP function strpos to verify whether the request has been made from whitelisted sites or not. Like in my case a request to the timthumb was made using the following URL:</p>
<div class="code">timthumb.php?src=http://blogger.com.n*****u.com/config.php</div>
<p>As you can see it asked timthumb to fetch an image from http://blogger.com.n*****u.com/config.php which is not actually an image file, the timthumb script copied that php file to the cache directory. Now as obvious, the PHP script can be executed directly from that cache directory and endlessly possible things can be done with it! In my case a shell was uploaded which looked like this.</p>
<p><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/uploaded-shell-script.png"><img class="aligncenter size-medium wp-image-903" title="uploaded-shell-script" src="http://www.intechgrity.com/wp-content/uploads/2011/11/uploaded-shell-script-300x189.png" alt="" width="300" height="189" /></a></p>
<p><em><span style="text-decoration: underline;">NOTE</span>: To take the above screenshot, I had decrypted the uploaded file and ran it on my localhost. Usually the files being uploaded are heavily encrypted and requires a password (md5 encoded) to gain access.</em></p>
<p>After that, the hacker used that shell to inject bad codes to all the index.php, footer.php, index.html files on my server.</p>
<h2>#3: Cleaning your WordPress website:</h2>
<p>In most of the cases the hack comes from a WordPress theme using timthumb to resize images. In order to clean your site, you first need to reinstall WP and then take preventive measures to stop this hack.</p>
<h3>#3.1: Clean and reinstall WP:</h3>
<p>At this point many of your WordPress files including all <strong>index.php  </strong>and <strong>wp-config.php</strong> are injected with malicious code. A script resides in your cache directory which allows the hacker to gain access to your server and many copy of that script has been put in different directories. The best way is a cleaner installation of WordPress.</p>
<ol>
<li>Change the DataBase password of your WordPress DB using your WebHost. This is very important.</li>
<li>Download all the files from <strong>wp-content</strong> directory. We shall use only the <strong>uploads</strong> directory to save your images.</li>
<li>Manually check each sub directories under <strong>/wp-content/uploads</strong> directory and delete all the files with a <strong>.php</strong> extension. Any PHP file found here should be a copy of the script. In my case a few PHP scripts with names like <strong>sys-options.php, new-classes.php, meta-tags.php</strong> were found. Make sure you delete them. After cleaning all these mess, retain a copy of the <strong>upload </strong>directory.</li>
<li>Delete everything under your Website&#8217;s <strong>public_html</strong> directory. Yes, everything. This ensures that no copies of the script is left.</li>
<li>Download a fresh copy of <a href="http://wordpress.org/">WordPress</a>. Edit the <strong>wp-config.php</strong> file and put in the <a href="http://codex.wordpress.org/Editing_wp-config.php">database details and salt details</a> manually. You should enter new salts from the <a href="https://api.wordpress.org/secret-key/1.1/salt/">WordPress Online generator</a>.</li>
<li>Upload the fresh copy of WP (with edited wp-config.php file) to your site&#8217;s <strong>public_html</strong> directory. Then navigate to <em>http://yoursite/wp-admin</em> &#8230; If required this will update the database of your WP setup. Then login to the Dashboard.</li>
<li>At this point, you don&#8217;t have the image files. There is no need to panic though. Just upload the <strong>cleaned /uploads</strong> directory to <strong>wp-content</strong> and you are all done.</li>
</ol>
<p>Now, it&#8217;s time to fix your theme.</p>
<h3>#3.2: Cleaning the WP theme and update timthumb:</h3>
<p>Many of the files of your theme should be hacked. Best is you download a fresh copy of your theme. If you have modified your theme, then you have to check in all php files manually and find and delete any trace of malicious code (You should probably know how to do, as you have modified your own theme <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ). Once done, update the timthumb with the latest code. It can be found <a href="http://code.google.com/p/timthumb/">here</a>.</p>
<p>Now simply upload the theme and activate it from WP admin panel. You are all done.</p>
<h2>#4: Cleaning general PHP &amp; HTML files:</h2>
<p>This can be quite hectic. In my case many static HTML and PHP files were injected with malicious codes. The only way is, check your files individually and remove them. You can also use editors like<a href="http://netbeans.org/"> NetBeans</a> to perform a search (search for &#8216;<em>eval</em>&#8216;) over a collection of files to quickly find all the infected files.</p>
<p><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/infected-php-files.png"><img class="aligncenter size-medium wp-image-902" title="infected-php-files" src="http://www.intechgrity.com/wp-content/uploads/2011/11/infected-php-files-300x147.png" alt="" width="300" height="147" /></a></p>
<p>Once found, clean them by deleting the codes and upload them to your server.</p>
<h2>#5: Searching the last trace of hack using SSH:</h2>
<p>This is very important. If you have access to SSH, then just type this command</p>
<pre>grep -r base64_decode *</pre>
<p>If you see any occurrence of this then you better investigate the file manually for any possible infection. If there is a long encoded string then probably that&#8217;s a bad code which you don&#8217;t want to keep.</p>
<p>So, that was all about how to fix this vulnerability and clean your site. Hope you have find it interesting and informative. Do not forget to add in your thoughts!</p>
<p>No related posts.</p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=9A8tDZahETI:E-OwQ0kaKEY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=9A8tDZahETI:E-OwQ0kaKEY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=9A8tDZahETI:E-OwQ0kaKEY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=9A8tDZahETI:E-OwQ0kaKEY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=9A8tDZahETI:E-OwQ0kaKEY:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=9A8tDZahETI:E-OwQ0kaKEY:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/9A8tDZahETI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/timthumb-vulerability-how-it-got-hacked-how-to-recover/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/timthumb-vulerability-how-it-got-hacked-how-to-recover/</feedburner:origLink></item>
		<item>
		<title>Intechgrity reincarnated –  Recovered from TimThumb vulnerability</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/YKAyc6xyHu8/</link>
		<comments>http://www.intechgrity.com/intechgrity-reincarnated-recovered-from-timthumb-vulnerability/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 07:15:52 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[About]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=895</guid>
		<description><![CDATA[It&#8217;s been quite a long and this time, I really had to suffer for my negligence. For a past few days, if you had a visit to our blog or any of our network sites, you should have noticed a &#8220;Malware Warning&#8221;. This was because of the known vulnerability of TimThumb which our theme was [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/we-are-finally-on-our-own-domain/' rel='bookmark' title='We are finally on our own Domain – inTechgrity.com'>We are finally on our own Domain – inTechgrity.com</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/ukSAlp1HFevsgZpUTOKDUz1M0lE/0/da"><img src="http://feedads.g.doubleclick.net/~a/ukSAlp1HFevsgZpUTOKDUz1M0lE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ukSAlp1HFevsgZpUTOKDUz1M0lE/1/da"><img src="http://feedads.g.doubleclick.net/~a/ukSAlp1HFevsgZpUTOKDUz1M0lE/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.intechgrity.com/wp-content/uploads/2011/11/security-itg.png"><img class="alignright size-full wp-image-896" title="security-itg" src="http://www.intechgrity.com/wp-content/uploads/2011/11/security-itg.png" alt="" width="200" height="200" /></a>It&#8217;s been quite a long and this time, I really had to suffer for my negligence. For a past few days, if you had a visit to our blog or any of our network sites, you should have noticed a &#8220;Malware Warning&#8221;. This was because of the known vulnerability of TimThumb which our theme was using. I believe on 7th Nov, our intechgrity blog was compromised and suspicious codes were injected. The worst thing was, all the index.php files residing on my server got infected. This includes all our sites:</p>
<ul>
<li>http://www.intechgrity.com</li>
<li>http://www.itgdesignbox.com</li>
<li>http://www.swashata.com</li>
<li>http://www.blakut.com</li>
<li>http://demo.intechgrity.com</li>
<li>http://itg.intechgrity.com</li>
<li>http://premium.itgdesignbox.com</li>
</ul>
<p>That&#8217;s quite a long list! There were other sites as well, but I have just removed them as they are no longer needed.</p>
<p>Well, whatever happens, happens for a reason. Thinking about the positive side of the hack, this was no exception. I have recoded the intechgrity theme using the latest version from <a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=5226_0_1_3" target="_blank">elegantthemes</a> which does not use timthumb at all. Also, I have cut the load of the home page a little. So the website loads faster now. Sprite images were also optimized. Hopefully this will (I believe has) improved the loading time of the site.</p>
<p>The worst loss is definitely the page visits. Just before 7th we had 1500 page visits/day which drastically dropped to 20 page visits/day. Because of my negligence it continued till 27th Nov, when I finally took the effort to fix all my sites. After two days of work, it got all fixed. And today we have 400 page visits so far. Hopefully this will improve over time.</p>
<p>Also, all our sites were submitted for a review on google webmaster and now they seems to be clean. This is indeed a good news.</p>
<p>So, this is the last time, I neglected my sites. From now on I will try my best to keep all my sites updated. Stay tuned, we have new surprises coming for you. It is anticipated to get full activity after december mid (when my semester exams are over). Thanks to all our visitor for their kind patience and support.</p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/we-are-finally-on-our-own-domain/' rel='bookmark' title='We are finally on our own Domain – inTechgrity.com'>We are finally on our own Domain – inTechgrity.com</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=YKAyc6xyHu8:vRfoHJmNb80:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=YKAyc6xyHu8:vRfoHJmNb80:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=YKAyc6xyHu8:vRfoHJmNb80:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=YKAyc6xyHu8:vRfoHJmNb80:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=YKAyc6xyHu8:vRfoHJmNb80:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=YKAyc6xyHu8:vRfoHJmNb80:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/YKAyc6xyHu8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/intechgrity-reincarnated-recovered-from-timthumb-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/intechgrity-reincarnated-recovered-from-timthumb-vulnerability/</feedburner:origLink></item>
		<item>
		<title>Properly add pagination to your WordPress Plugin</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/ABYuH6eDqc4/</link>
		<comments>http://www.intechgrity.com/properly-add-pagination-to-your-wordpress-plugin/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 07:48:37 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[Wordpress APIs]]></category>
		<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress api]]></category>
		<category><![CDATA[wordpress hacks]]></category>
		<category><![CDATA[wordpress template]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=794</guid>
		<description><![CDATA[It has been quite a long I am doing stuffs with WordPress. The one of the nice thing about WordPress is, we get a ready to use admin backend with almost all possible css&#8217; needed! Nice table structure, nested menu, Title with nice icons, pagination&#8230;you just name it! WordPress has them all! To use them, [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/determine-plugin-directory-and-url-in-wordpress-using-wp-api/' rel='bookmark' title='Determine Plugin Directory and URL in WordPress using WP API'>Determine Plugin Directory and URL in WordPress using WP API</a></li>
<li><a href='http://www.intechgrity.com/how-to-add-your-own-stylesheet-to-your-wordpress-plugin-settings-page-or-all-admin-page/' rel='bookmark' title='How to add your own stylesheet to your WordPress plugin settings page or All Admin page'>How to add your own stylesheet to your WordPress plugin settings page or All Admin page</a></li>
<li><a href='http://www.intechgrity.com/add-dynamic-login-logout-n-site-admin-button-to-wordpress-using-wp-api/' rel='bookmark' title='Add dynamic Login Logout n Site Admin button to WordPress using WP API'>Add dynamic Login Logout n Site Admin button to WordPress using WP API</a></li>
<li><a href='http://www.intechgrity.com/parse-id-list-from-csv-using-new-wordpress-3-0-api-the-right-way-of-doing/' rel='bookmark' title='Parse ID list from CSV, using new WordPress 3.0 API &#8211; The right way of doing'>Parse ID list from CSV, using new WordPress 3.0 API &#8211; The right way of doing</a></li>
<li><a href='http://www.intechgrity.com/make-google-adsense-custom-search-with-wordpress-custom-page-template/' rel='bookmark' title='Make Google Adsense custom Search with WordPress Custom Page Template'>Make Google Adsense custom Search with WordPress Custom Page Template</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/-WoQQ8QSTcpNR-oJz9FM9yv2SuQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/-WoQQ8QSTcpNR-oJz9FM9yv2SuQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-WoQQ8QSTcpNR-oJz9FM9yv2SuQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/-WoQQ8QSTcpNR-oJz9FM9yv2SuQ/1/di" border="0" ismap="true"></img></a></p><p><img class="aligncenter size-full wp-image-845" title="wp-pagination-tutorial" src="http://www.intechgrity.com/wp-content/uploads/2011/07/wp-pagination-tutorial.png" alt="" width="500" height="300" />It has been quite a long I am doing stuffs with WordPress. The one of the nice thing about WordPress is, we get a ready to use admin backend with almost all possible css&#8217; needed! Nice table structure, nested menu, Title with nice icons, <em>pagination</em>&#8230;you just name it! WordPress has them all! To use them, what we need to do is code our plugin so that it generates the proper <em>xhtml code</em> with proper <em>css classes</em>. Finding the correct CSS for the correct XHTML can be a little hectic sometimes as it involves reading the source code of WP a bit, but when you are done with it, trust me you will find that you will never need to code CSS for your Admin backend again!</p>
<p>So, in this tutorial, I am going to tell you <strong>How to properly add pagination to your WordPress Plugin!</strong> Of course, properly in the sense of proper xHTML structure with proper CSS. Even better is, I have created a class file which you can directly use on your plugins to create pagination in no time. So enough of this introduction, let us get into the business!</p>
<h2>#1: WordPress backend pagination, Looks and Source code:</h2>
<p>The pagination is basically a way to split long list of records into several pages, so that it reduces the load on the browser and the server, while displaying a humanly easy to interpret list of data. For example, if you have quite a number of posts, then you should have seen links above and below the post tables to different pages.</p>
<p><a href="http://www.intechgrity.com/wp-content/uploads/2011/07/wp-pagination-preview.jpg"><img class="aligncenter size-medium wp-image-844" title="wp pagination preview" src="http://www.intechgrity.com/wp-content/uploads/2011/07/wp-pagination-preview-300x48.jpg" alt="" width="300" height="48" /></a></p>
<p>WordPress deals nicely with the pagination design. In order to get that, you need to have the following piece of XHTML code in your plugin:</p>
<pre class="brush: xml; title: The XHTML Code structure of Pagination; notranslate">
&lt;div class=&quot;tablenav&quot;&gt;
    &lt;div class=&quot;alignleft actions&quot;&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Bulk Delete&quot; class=&quot;button-secondary&quot;&gt;
    &lt;/div&gt;
    &lt;div class=&quot;tablenav-pages&quot;&gt;
        &lt;span class=&quot;displaying-num&quot;&gt;28 items&lt;/span&gt;
        &lt;span class=&quot;pagination-links&quot;&gt;
            &lt;a class=&quot;disabled&quot; href=&quot;javascript: void(0)&quot;&gt;« Previous&lt;/a&gt;
        &lt;a class=&quot;current&quot; href=&quot;javascript: void(0)&quot;&gt;1&lt;/a&gt;
            &lt;a href=&quot;admin.php?page=itgdb_iwifm_admin_show_form&amp;amp;p=2&quot;&gt;2&lt;/a&gt;
            &lt;a class=&quot;next&quot; href=&quot;admin.php?page=itgdb_iwifm_admin_show_form&amp;amp;p=2&quot;&gt;Next »&lt;/a&gt;
        &lt;/span&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Seems easy enough? Now, let us make it a bit more easier.</p>
<h2>#2: A pagination class for using with WordPress:</h2>
<p>Depending on this <em>xhtml </em>structure, I created a pagination class. This class is actually ported from the famous <a href="http://mis-algoritmos.com/2007/05/27/digg-style-pagination-class/" target="_blank">Digg Style Pagination Class</a> by <a href="http://mis-algoritmos.com/" target="_blank">Victor De la Rocha.</a></p>
<pre class="brush: php; title: The Pagination Class file for WP; notranslate">
class pagination {
    /**
     *  Script Name: WP Style Pagination Class
     *  Created From: *Digg Style Paginator Class
     *  Script URI: http://www.intechgrity.com/?p=794
     *  Original Script URI: http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
     *  Description: Class in PHP that allows to use a pagination like WP in your WP Plugins
     *  Script Version: 1.0.0
     *
     *  Author: Swashata Ghosh &lt;swashata4u@gmail.com
     *  Author URI: http://www.intechgrity.com/
     *  Original Author: Victor De la Rocha
     */

    /* Default values */

    var $total_pages = -1; //items
    var $limit = null;
    var $target = &quot;&quot;;
    var $page = 1;
    var $adjacents = 2;
    var $showCounter = false;
    var $className = &quot;pagination-links&quot;;
    var $parameterName = &quot;p&quot;;

    /* Buttons next and previous */
    var $nextT = &quot;Next&quot;;
    var $nextI = &quot;&amp;#187;&quot;; //&amp;#9658;
    var $prevT = &quot;Previous&quot;;
    var $prevI = &quot;&amp;#171;&quot;; //&amp;#9668;

    /*     * ** */
    var $calculate = false;

    #Total items

    function items($value) {
        $this-&gt;total_pages = (int) $value;
    }

    #how many items to show per page

    function limit($value) {
        $this-&gt;limit = (int) $value;
    }

    #Page to sent the page value

    function target($value) {
        $this-&gt;target = $value;
    }

    #Current page

    function currentPage($value) {
        $this-&gt;page = (int) $value;
    }

    #How many adjacent pages should be shown on each side of the current page?

    function adjacents($value) {
        $this-&gt;adjacents = (int) $value;
    }

    #show counter?

    function showCounter($value=&quot;&quot;) {
        $this-&gt;showCounter = ($value === true) ? true : false;
    }

    #to change the class name of the pagination div

    function changeClass($value=&quot;&quot;) {
        $this-&gt;className = $value;
    }

    function nextLabel($value) {
        $this-&gt;nextT = $value;
    }

    function nextIcon($value) {
        $this-&gt;nextI = $value;
    }

    function prevLabel($value) {
        $this-&gt;prevT = $value;
    }

    function prevIcon($value) {
        $this-&gt;prevI = $value;
    }

    #to change the class name of the pagination div

    function parameterName($value=&quot;&quot;) {
        $this-&gt;parameterName = $value;
    }

    var $pagination;

    function pagination() {

    }

    function show() {
        if (!$this-&gt;calculate)
            if ($this-&gt;calculate())
                echo &quot;&lt;span class=\&quot;$this-&gt;className\&quot;&gt;$this-&gt;pagination&lt;/span&gt;\n&quot;;
    }

    function getOutput() {
        if (!$this-&gt;calculate)
            if ($this-&gt;calculate())
                return &quot;&lt;span class=\&quot;$this-&gt;className\&quot;&gt;$this-&gt;pagination&lt;/span&gt;\n&quot;;
    }

    function get_pagenum_link($id) {
        if (strpos($this-&gt;target, '?') === false)
            return &quot;$this-&gt;target?$this-&gt;parameterName=$id&quot;;
        else
            return &quot;$this-&gt;target&amp;$this-&gt;parameterName=$id&quot;;
    }

    function calculate() {
        $this-&gt;pagination = &quot;&quot;;
        $this-&gt;calculate == true;
        $error = false;

        if ($this-&gt;total_pages &lt; 0) {
            echo &quot;It is necessary to specify the &lt;strong&gt;number of pages&lt;/strong&gt; (\$class-&gt;items(1000))&lt;br /&gt;&quot;;
            $error = true;
        }
        if ($this-&gt;limit == null) {
            echo &quot;It is necessary to specify the &lt;strong&gt;limit of items&lt;/strong&gt; to show per page (\$class-&gt;limit(10))&lt;br /&gt;&quot;;
            $error = true;
        }
        if ($error)
            return false;

        $n = trim($this-&gt;nextT . ' ' . $this-&gt;nextI);
        $p = trim($this-&gt;prevI . ' ' . $this-&gt;prevT);

        /* Setup vars for query. */
        if ($this-&gt;page)
            $start = ($this-&gt;page - 1) * $this-&gt;limit;             //first item to display on this page
        else
            $start = 0;                                //if no page var is given, set start to 0

        /* Setup page vars for display. */
        $prev = $this-&gt;page - 1;                            //previous page is page - 1
        $next = $this-&gt;page + 1;                            //next page is page + 1
        $lastpage = ceil($this-&gt;total_pages / $this-&gt;limit);        //lastpage is = total pages / items per page, rounded up.
        $lpm1 = $lastpage - 1;                        //last page minus 1

        /*
          Now we apply our rules and draw the pagination object.
          We're actually saving the code to a variable in case we want to draw it more than once.
         */

        if ($lastpage &gt; 1) {
            if ($this-&gt;page) {
                //anterior button
                if ($this-&gt;page &gt; 1)
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($prev) . &quot;\&quot; class=\&quot;prev\&quot;&gt;$p&lt;/a&gt;&quot;;
                else
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;javascript: void(0)\&quot; class=\&quot;disabled\&quot;&gt;$p&lt;/a&gt;&quot;;
            }
            //pages
            if ($lastpage &lt; 7 + ($this-&gt;adjacents * 2)) {//not enough pages to bother breaking it up
                for ($counter = 1; $counter &lt;= $lastpage; $counter++) {
                    if ($counter == $this-&gt;page)
                        $this-&gt;pagination .= &quot;&lt;a href=\&quot;javascript: void(0)\&quot; class=\&quot;current\&quot;&gt;$counter&lt;/a&gt;&quot;;
                    else
                        $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($counter) . &quot;\&quot;&gt;$counter&lt;/a&gt;&quot;;
                }
            }
            elseif ($lastpage &gt; 5 + ($this-&gt;adjacents * 2)) {//enough pages to hide some
                //close to beginning; only hide later pages
                if ($this-&gt;page &lt; 1 + ($this-&gt;adjacents * 2)) {
                    for ($counter = 1; $counter &lt; 4 + ($this-&gt;adjacents * 2); $counter++) {
                        if ($counter == $this-&gt;page)
                            $this-&gt;pagination .= &quot;&lt;a href=\&quot;javascript: void(0)\&quot; class=\&quot;current\&quot;&gt;$counter&lt;/a&gt;&quot;;
                        else
                            $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($counter) . &quot;\&quot;&gt;$counter&lt;/a&gt;&quot;;
                    }
                    $this-&gt;pagination .= &quot;&lt;span&gt;...&lt;/span&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($lpm1) . &quot;\&quot;&gt;$lpm1&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($lastpage) . &quot;\&quot;&gt;$lastpage&lt;/a&gt;&quot;;
                }
                //in middle; hide some front and some back
                elseif ($lastpage - ($this-&gt;adjacents * 2) &gt; $this-&gt;page &amp;&amp; $this-&gt;page &gt; ($this-&gt;adjacents * 2)) {
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link(1) . &quot;\&quot;&gt;1&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link(2) . &quot;\&quot;&gt;2&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;span&gt;...&lt;/span&gt;&quot;;
                    for ($counter = $this-&gt;page - $this-&gt;adjacents; $counter &lt;= $this-&gt;page + $this-&gt;adjacents; $counter++)
                        if ($counter == $this-&gt;page)
                            $this-&gt;pagination .= &quot;&lt;a href=\&quot;javascript: void(0)\&quot; class=\&quot;current\&quot;&gt;$counter&lt;/a&gt;&quot;;
                        else
                            $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($counter) . &quot;\&quot;&gt;$counter&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;span&gt;...&lt;/span&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($lpm1) . &quot;\&quot;&gt;$lpm1&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($lastpage) . &quot;\&quot;&gt;$lastpage&lt;/a&gt;&quot;;
                }
                //close to end; only hide early pages
                else {
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link(1) . &quot;\&quot;&gt;1&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link(2) . &quot;\&quot;&gt;2&lt;/a&gt;&quot;;
                    $this-&gt;pagination .= &quot;&lt;span&gt;...&lt;/span&gt;&quot;;
                    for ($counter = $lastpage - (2 + ($this-&gt;adjacents * 2)); $counter &lt;= $lastpage; $counter++)
                        if ($counter == $this-&gt;page)
                            $this-&gt;pagination .= &quot;&lt;a href=\&quot;javascript: void(0)\&quot; class=\&quot;current\&quot;&gt;$counter&lt;/a&gt;&quot;;
                        else
                            $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($counter) . &quot;\&quot;&gt;$counter&lt;/a&gt;&quot;;
                }
            }
            if ($this-&gt;page) {
                //siguiente button
                if ($this-&gt;page &lt; $counter - 1)
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;&quot; . $this-&gt;get_pagenum_link($next) . &quot;\&quot; class=\&quot;next\&quot;&gt;$n&lt;/a&gt;&quot;;
                else
                    $this-&gt;pagination .= &quot;&lt;a href=\&quot;javascript: void(0)\&quot; class=\&quot;disabled\&quot;&gt;$n&lt;/a&gt;&quot;;
            }
        }

        return true;
    }

}
</pre>
<p>Just copy the above code to your Plugin files and use it something like this:</p>
<pre class="brush: php; html-script: true; title: Usage of the Class; notranslate">
&lt;?php
//get the number of records in the database table
$pagination_count = $wpdb-&gt;get_var($wpdb-&gt;prepare(&quot;SELECT COUNT(`id`) FROM `&quot; . $wpdb-&gt;prefix . &quot;my_plugin_table`&quot;));
if($pagination_count &gt; 0) {
    //get current page
    $this_page = ($_GET['p'] &amp;&amp; $_GET['p'] &gt; 0)? (int) $_GET['p'] : 1;
    //Records per page
    $per_page = 25;
    //Total Page
    $total_page = ceil($pagination_count/$per_page);

    //initiate the pagination variable
    $pag = new pagination();
    //Set the pagination variable values
    $pag-&gt;Items($pagination_count);
    $pag-&gt;limit($per_page);
    $pag-&gt;target(&quot;admin.php?page=itgdb_iwifm_admin_show_form&quot;);
    $pag-&gt;currentPage($this_page);

    //Done with the pagination
    //Now get the entries
    //But before that a little anomaly checking
    $list_start = ($this_page - 1)*$per_page;
    if($list_start &gt;= $pagination_count)  //Start of the list should be less than pagination count
        $list_start = ($pagination_count - $per_page);
    if($list_start &lt; 0) //list start cannot be negative
        $list_start = 0;
    $list_end = ($this_page * $per_page) - 1;

    //Get the data from the database
    $records = $wpdb-&gt;get_results($wpdb-&gt;prepare(&quot;SELECT * FROM `&quot; . $wpdb-&gt;prefix . &quot;my_plugin_table` ORDER BY `my_field1` DESC LIMIT %d, %d&quot;, $list_start, $per_page));

    if($records) {
        //Do something with it! Probably display table
        ?&gt;
        &lt;table class=&quot;widefat&quot;&gt;
            &lt;thead&gt;
                &lt;tr&gt;
                    &lt;td&gt;Field 1&lt;/td&gt;
                    &lt;td&gt;Field 2&lt;/td&gt;
                &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
                &lt;?php
                //loop through
                foreach($records as $record) {
                    ?&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        &lt;?php echo $record-&gt;field1; ?&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                        &lt;?php echo $record-&gt;field2; ?&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
                    &lt;?php
                }
                ?&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
        &lt;?php
        //Now display the pagiantion links
        ?&gt;
            &lt;div class=&quot;tablenav&quot;&gt;
                &lt;div class=&quot;alignleft actions&quot;&gt;
                    &lt;input type=&quot;submit&quot; class=&quot;button-secondary&quot; value=&quot;Bulk Delete&quot; /&gt;
                &lt;/div&gt;
                &lt;div class=&quot;tablenav-pages&quot;&gt;
                    &lt;span class=&quot;displaying-num&quot;&gt;&lt;?php echo $pagination_count; ?&gt; items&lt;/span&gt;
                    &lt;?php $pag-&gt;show(); ?&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;?php
    }
    else {
        echo '&lt;div class=&quot;error&quot;&gt;&lt;p&gt;Something Went wrong! Check&lt;/p&gt;&lt;/div&gt;';
    }
}
else {
    echo '&lt;div class=&quot;error&quot;&gt;&lt;p&gt;No Data&lt;/p&gt;&lt;/div&gt;';
}
?&gt;
</pre>
<p>The best thing is, you don&#8217;t even have to code any sort of other CSS for this pagination. The WordPress admin.css file has all the codes needed to style up the markups! So just get the class and enjoy coding your WordPress plugin the way it is meant to be!</p>
<p>I hope, you have found this tutorial helpful! If you need any help then feel free to ask, and as usual, <strong>don&#8217;t forget to give your feedback!</strong></p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/determine-plugin-directory-and-url-in-wordpress-using-wp-api/' rel='bookmark' title='Determine Plugin Directory and URL in WordPress using WP API'>Determine Plugin Directory and URL in WordPress using WP API</a></li>
<li><a href='http://www.intechgrity.com/how-to-add-your-own-stylesheet-to-your-wordpress-plugin-settings-page-or-all-admin-page/' rel='bookmark' title='How to add your own stylesheet to your WordPress plugin settings page or All Admin page'>How to add your own stylesheet to your WordPress plugin settings page or All Admin page</a></li>
<li><a href='http://www.intechgrity.com/add-dynamic-login-logout-n-site-admin-button-to-wordpress-using-wp-api/' rel='bookmark' title='Add dynamic Login Logout n Site Admin button to WordPress using WP API'>Add dynamic Login Logout n Site Admin button to WordPress using WP API</a></li>
<li><a href='http://www.intechgrity.com/parse-id-list-from-csv-using-new-wordpress-3-0-api-the-right-way-of-doing/' rel='bookmark' title='Parse ID list from CSV, using new WordPress 3.0 API &#8211; The right way of doing'>Parse ID list from CSV, using new WordPress 3.0 API &#8211; The right way of doing</a></li>
<li><a href='http://www.intechgrity.com/make-google-adsense-custom-search-with-wordpress-custom-page-template/' rel='bookmark' title='Make Google Adsense custom Search with WordPress Custom Page Template'>Make Google Adsense custom Search with WordPress Custom Page Template</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ABYuH6eDqc4:1XjjhcX33j0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ABYuH6eDqc4:1XjjhcX33j0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ABYuH6eDqc4:1XjjhcX33j0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ABYuH6eDqc4:1XjjhcX33j0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ABYuH6eDqc4:1XjjhcX33j0:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ABYuH6eDqc4:1XjjhcX33j0:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/ABYuH6eDqc4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/properly-add-pagination-to-your-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/properly-add-pagination-to-your-wordpress-plugin/</feedburner:origLink></item>
		<item>
		<title>Howto: Use jQuery UI dialog as reusable modal prompt</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/ttKRofOMluI/</link>
		<comments>http://www.intechgrity.com/howto-use-jquery-ui-dialog-as-reusable-modal-prompt/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 04:33:44 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery-UI]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=832</guid>
		<description><![CDATA[jQuery UI has always been my favorite tool for creating custom and rich User Interface. On my last project, I thought of using the UI dialog as reusable modal prompts, just like some jQuery plugins like Colorbox, Fancybox etc. But while doing that I faced some problem like, chaining the dialog to multiple class based [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/add-background-arrow-image-to-external/' rel='bookmark' title='Add background arrow image to external or third party links automatically using jQuery on Website/Blog [Also on Blogger]'>Add background arrow image to external or third party links automatically using jQuery on Website/Blog [Also on Blogger]</a></li>
<li><a href='http://www.intechgrity.com/complete-faq-related-to-jquery-and/' rel='bookmark' title='Complete FAQ related to jQuery and Plugins – Beginners guide to work with jQuery'>Complete FAQ related to jQuery and Plugins – Beginners guide to work with jQuery</a></li>
<li><a href='http://www.intechgrity.com/jquery-fade-n-slide-button-animator-plugin-by-itg/' rel='bookmark' title='jQuery Fade n Slide Button Animator Plugin by iTg'>jQuery Fade n Slide Button Animator Plugin by iTg</a></li>
<li><a href='http://www.intechgrity.com/fade-in-n-out-animation-on-hover-w/' rel='bookmark' title='Fade In n Out Animation on hover w/ jQuery to make image Buttons'>Fade In n Out Animation on hover w/ jQuery to make image Buttons</a></li>
<li><a href='http://www.intechgrity.com/sliding-hover-animation-using-jquery-to/' rel='bookmark' title='Sliding Hover animation using jQuery to make cool image buttons'>Sliding Hover animation using jQuery to make cool image buttons</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/ktKB8wdxzvNGKFAkGqOXNkFSA0Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/ktKB8wdxzvNGKFAkGqOXNkFSA0Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ktKB8wdxzvNGKFAkGqOXNkFSA0Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/ktKB8wdxzvNGKFAkGqOXNkFSA0Y/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.intechgrity.com/wp-content/uploads/2011/07/jQuery-tutorial.png"><img class="aligncenter size-full wp-image-839" title="jQuery-tutorial" src="http://www.intechgrity.com/wp-content/uploads/2011/07/jQuery-tutorial.png" alt="" width="500" height="300" /></a>jQuery UI has always been my favorite tool for creating custom and rich User Interface. On my last project, I thought of using the UI dialog as reusable modal prompts, just like some jQuery plugins like <a href="http://colorpowered.com/colorbox/" target="_blank">Colorbox</a>, <a href="http://fancybox.net/" target="_blank">Fancybox</a> etc. But while doing that I faced some problem like, chaining the dialog to multiple class based selectors and attaching the dialog open events to respective anchor elements. After reading the documentation a bit, I came up with a nice solution which works and does not load the browser! So, in this post I am going to discuss it. But before we do, as usual, here are the links to the online demo and the script!</p>
<div class="demo-download">
<a class="demo" target="_blank" href="http://demo.intechgrity.com/jq_ui_dialog/">Demo</a><a class="download" title="jQuery UI Dialog Downloaded 139" href="http://www.intechgrity.com/downloads/11">Download Now</a>
</div>
<h2>#1: The problem &amp; the approach:</h2>
<ul>
<li>The UI dialog box automatically opens when the document(page) loads, and gets destroyed when the close button is clicked.</li>
<li>We want to make several UI dialogs using the css class selector and also want to attach their opening call to respective anchor elements. Doing the thing with specific ID selector is not a good idea because we have to write separate code for each of the dialog and the firing anchor elements.</li>
<li>If we attach the dialog UI directly to the anchor element, then it will get destroyed after first use and the anchor will not bring any further dialog prompt. So we need to save the dialog under some sort of variable and must attach that dialog&#8217;s open call to the click even of the anchor using that variable.</li>
<li>So we can actually <strong>loop through all the anchor elements</strong> (<em>they should be given same class names for easy looping</em>) and somehow <strong>get their corresponding dialog prompts</strong> saved inside somehow related tags and save those dialogs inside some <strong>local variable</strong>.</li>
</ul>
<p><a href="http://www.intechgrity.com/wp-content/uploads/2011/07/jQuery-UI-Button.jpg"><img class="aligncenter size-medium wp-image-840" title="jQuery UI Button" src="http://www.intechgrity.com/wp-content/uploads/2011/07/jQuery-UI-Button-300x148.jpg" alt="" width="300" height="148" /></a></p>
<h2>#2: The structure of the CODE:</h2>
<p>Considering all these problems and their resolving approaches, we first make the XHTML code as follows:</p>
<pre class="brush: xml; title: The HTML structure; notranslate">
&lt;a class=&quot;dialog_but&quot; href=&quot;#&quot;&gt;Button 1&lt;/a&gt;
&lt;div class=&quot;dialog_content&quot;&gt;This is Dialog One!&lt;/div&gt;

&lt;a class=&quot;dialog_but&quot; href=&quot;#&quot;&gt;Button 2&lt;/a&gt;
&lt;div class=&quot;dialog_content&quot;&gt;This is Dialog One!&lt;/div&gt;

&lt;a class=&quot;dialog_but&quot; href=&quot;#&quot;&gt;
    Button 3
&lt;/a&gt;
&lt;div class=&quot;dialog_content&quot;&gt;
    &lt;p&gt;Another dialog prompt with a little bit &lt;em&gt;More&lt;/em&gt; &lt;strong&gt;HTML&lt;/strong&gt;&lt;/p&gt;
    &lt;img src=&quot;image/nice_robot.png&quot; style=&quot;float: right; margin: 0 0 10px 10px&quot; /&gt;
    &lt;p&gt;
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et mauris erat. Morbi placerat semper sodales. Pellentesque sollicitudin quam id erat iaculis convallis eleifend odio aliquet. Aenean pulvinar adipiscing enim id sodales. Pellentesque tellus eros, interdum vel dignissim ac, dignissim sit amet dui. Integer felis augue, condimentum eget ullamcorper et, hendrerit at lacus. Nulla placerat ipsum at risus consectetur sit amet suscipit dui pellentesque. Sed sed elit a orci ornare posuere bibendum sodales turpis. Fusce euismod ante ut nunc pharetra facilisis. Nulla laoreet malesuada lacus, in sagittis urna adipiscing nec. Proin accumsan dolor vitae urna convallis non pretium odio convallis. Integer nisi lorem, varius in bibendum sit amet, scelerisque vel libero. Proin placerat pharetra congue. Sed tempus augue vitae nisl viverra hendrerit at nec purus. Vivamus laoreet erat vel turpis scelerisque at elementum sapien ultrices. Nulla at leo diam. Praesent hendrerit imperdiet ultricies. Curabitur vestibulum turpis in lacus faucibus convallis. Quisque nec magna nulla.
    &lt;/p&gt;
    &lt;p&gt;
        Nullam orci nisi, laoreet eget adipiscing sit amet, porta ut leo. Nulla at condimentum mauris. Duis sed lectus ligula, a scelerisque eros. Donec bibendum eleifend ullamcorper. Pellentesque eu ante sed augue feugiat condimentum sit amet eu leo. Sed sodales ipsum at risus iaculis ac bibendum odio faucibus. Phasellus leo ligula, euismod id interdum vel, convallis ac sapien. Sed ut felis mauris. Suspendisse faucibus aliquam tortor a convallis. Fusce aliquet libero id arcu condimentum tincidunt. Morbi laoreet, ante nec tristique porta, eros odio molestie urna, eget accumsan nibh ligula ut nisi. Curabitur suscipit eros at sapien vestibulum blandit ut vitae orci. Integer vitae risus ante, in dapibus felis. Curabitur dignissim nisl ut dui suscipit at eleifend metus feugiat. Maecenas porta sagittis aliquam.
    &lt;/p&gt;
&lt;/div&gt;
</pre>
<p>As you might already have noticed, the a.dialog_but elements are the dialog firing elements, and the div.dialog_content elements <em>next</em> to them are the div&#8217;s actually holding the dialog prompt data! Keeping this structure in mind, we code the following jQuery code!</p>
<pre class="brush: jscript; title: The jQuery code behind; notranslate">
//do when the dom is ready
jQuery(document).ready(function($) {
    //loop through every button anchor element
    $('.dialog_but').each(function() {
        //create a local scope of a dialog variable to attach
        var $dialog;

        //create the dialog for the div.dialog_content standing next to the anchor element
        //we make the autoOpen false so that it can be reusable
        //also we set the modal = true to appear the dialog as a modal prompt
        $dialog = $(this).next('div.dialog_content').dialog({modal: true, autoOpen: false, width: 600});

        //now attach the open even of the dialog to the anchor element
        $(this).click(function(e) {
            //prevent the anchor element to go to the hyperlinked page
            e.preventDefault();

            //open the dialog
            $dialog.dialog('open');
        });
    });
});
</pre>
<p>As obvious, the code will work something like</p>
<ol>
<li>When the document is ready, loop through every a.dialog_but elements (<em>using the jQuery </em>.each <em>API</em>).</li>
<li>Inside the .each function, create a local variable $dialog (using the keyword var) and store the dialog inside that variable.</li>
<li>The dialog element is nothing but the div.dialog_content next to it (<em>using the jQuery </em>.next <em>API</em>).</li>
<li>Also, at the same time, we add a click event to that anchor. The event is nothing but firing the <strong>open</strong> call of the $dialog</li>
</ol>
<p>In this way we create a simple and working modal dialog prompt using jQuery UI.</p>
<p>A complete will be something like this:</p>
<pre class="brush: jscript; html-script: true; title: A complete webpage example; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
    &lt;head&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
        &lt;!-- include the jQuery and jQuery UI JS and CSS code --&gt;
        &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;http://jquery-ui.googlecode.com/svn/trunk/themes/base/jquery.ui.all.css&quot; /&gt;
        &lt;script src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' type='text/javascript'&gt;&lt;/script&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js&quot;&gt;&lt;/script&gt;

        &lt;!-- The jQuery code for the UI dialog --&gt;
        &lt;script type=&quot;text/javascript&quot;&gt;
            //do when the dom is ready
            jQuery(document).ready(function($) {
                //loop through every button anchor element
                $('.dialog_but').each(function() {
                    //create a local scope of a dialog variable to attach
                    var $dialog;

                    //create the dialog for the div.dialog_content standing next to the anchor element
                    //we make the autoOpen false so that it can be reusable
                    //also we set the modal = true to appear the dialog as a modal prompt
                    $dialog = $(this).next('div.dialog_content').dialog({modal: true, autoOpen: false, width: 600});

                    //now attach the open even of the dialog to the anchor element
                    $(this).click(function(e) {
                        //prevent the anchor element to go to the hyperlinked page
                        e.preventDefault();

                        //open the dialog
                        $dialog.dialog('open');
                    });
                });
            });
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div&gt;
            &lt;p&gt;
                &lt;a class=&quot;dialog_but&quot; href=&quot;#&quot;&gt;Button 1&lt;/a&gt; &lt;div class=&quot;dialog_content&quot;&gt;This is Dialog One!&lt;/div&gt;
            &lt;/p&gt;
            &lt;p&gt;
                &lt;a class=&quot;dialog_but&quot; href=&quot;#&quot;&gt;Button 2&lt;/a&gt; &lt;div class=&quot;dialog_content&quot;&gt;This is Dialog One!&lt;/div&gt;
            &lt;/p&gt;
            &lt;p&gt;
                &lt;a class=&quot;dialog_but&quot; href=&quot;#&quot;&gt;
                    Button BIG
                &lt;/a&gt;
                &lt;div class=&quot;dialog_content&quot;&gt;
                    &lt;p&gt;Another dialog prompt with a little bit &lt;em&gt;More&lt;/em&gt; &lt;strong&gt;HTML&lt;/strong&gt;&lt;/p&gt;
                    &lt;img src=&quot;image/nice_robot.png&quot; style=&quot;float: right; margin: 0 0 10px 10px&quot; /&gt;
                    &lt;p&gt;
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi et mauris erat. Morbi placerat semper sodales. Pellentesque sollicitudin quam id erat iaculis convallis eleifend odio aliquet. Aenean pulvinar adipiscing enim id sodales. Pellentesque tellus eros, interdum vel dignissim ac, dignissim sit amet dui. Integer felis augue, condimentum eget ullamcorper et, hendrerit at lacus. Nulla placerat ipsum at risus consectetur sit amet suscipit dui pellentesque. Sed sed elit a orci ornare posuere bibendum sodales turpis. Fusce euismod ante ut nunc pharetra facilisis. Nulla laoreet malesuada lacus, in sagittis urna adipiscing nec. Proin accumsan dolor vitae urna convallis non pretium odio convallis. Integer nisi lorem, varius in bibendum sit amet, scelerisque vel libero. Proin placerat pharetra congue. Sed tempus augue vitae nisl viverra hendrerit at nec purus. Vivamus laoreet erat vel turpis scelerisque at elementum sapien ultrices. Nulla at leo diam. Praesent hendrerit imperdiet ultricies. Curabitur vestibulum turpis in lacus faucibus convallis. Quisque nec magna nulla.
                    &lt;/p&gt;
                    &lt;p&gt;
                        Nullam orci nisi, laoreet eget adipiscing sit amet, porta ut leo. Nulla at condimentum mauris. Duis sed lectus ligula, a scelerisque eros. Donec bibendum eleifend ullamcorper. Pellentesque eu ante sed augue feugiat condimentum sit amet eu leo. Sed sodales ipsum at risus iaculis ac bibendum odio faucibus. Phasellus leo ligula, euismod id interdum vel, convallis ac sapien. Sed ut felis mauris. Suspendisse faucibus aliquam tortor a convallis. Fusce aliquet libero id arcu condimentum tincidunt. Morbi laoreet, ante nec tristique porta, eros odio molestie urna, eget accumsan nibh ligula ut nisi. Curabitur suscipit eros at sapien vestibulum blandit ut vitae orci. Integer vitae risus ante, in dapibus felis. Curabitur dignissim nisl ut dui suscipit at eleifend metus feugiat. Maecenas porta sagittis aliquam.
                    &lt;/p&gt;
                &lt;/div&gt;
            &lt;/p&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<div class="demo-download">
<a class="demo" target="_blank" href="http://demo.intechgrity.com/jq_ui_dialog/">Demo</a><a class="download" title="jQuery UI Dialog Downloaded 139" href="http://www.intechgrity.com/downloads/11">Download Now</a>
</div>
<p>For more information, you may like reading about <a href="http://jqueryui.com/demos/dialog/" target="_blank">jQuery UI dialog documentation</a> or download the source code from above and try it yourself!</p>
<p>If you have any trouble understanding then feel free to ask! Also don&#8217;t forget to give your valuable comments.</p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/add-background-arrow-image-to-external/' rel='bookmark' title='Add background arrow image to external or third party links automatically using jQuery on Website/Blog [Also on Blogger]'>Add background arrow image to external or third party links automatically using jQuery on Website/Blog [Also on Blogger]</a></li>
<li><a href='http://www.intechgrity.com/complete-faq-related-to-jquery-and/' rel='bookmark' title='Complete FAQ related to jQuery and Plugins – Beginners guide to work with jQuery'>Complete FAQ related to jQuery and Plugins – Beginners guide to work with jQuery</a></li>
<li><a href='http://www.intechgrity.com/jquery-fade-n-slide-button-animator-plugin-by-itg/' rel='bookmark' title='jQuery Fade n Slide Button Animator Plugin by iTg'>jQuery Fade n Slide Button Animator Plugin by iTg</a></li>
<li><a href='http://www.intechgrity.com/fade-in-n-out-animation-on-hover-w/' rel='bookmark' title='Fade In n Out Animation on hover w/ jQuery to make image Buttons'>Fade In n Out Animation on hover w/ jQuery to make image Buttons</a></li>
<li><a href='http://www.intechgrity.com/sliding-hover-animation-using-jquery-to/' rel='bookmark' title='Sliding Hover animation using jQuery to make cool image buttons'>Sliding Hover animation using jQuery to make cool image buttons</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ttKRofOMluI:hq0CXldYnTs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ttKRofOMluI:hq0CXldYnTs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ttKRofOMluI:hq0CXldYnTs:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ttKRofOMluI:hq0CXldYnTs:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=ttKRofOMluI:hq0CXldYnTs:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=ttKRofOMluI:hq0CXldYnTs:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/ttKRofOMluI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/howto-use-jquery-ui-dialog-as-reusable-modal-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/howto-use-jquery-ui-dialog-as-reusable-modal-prompt/</feedburner:origLink></item>
		<item>
		<title>iTg Sexy Horizontal 1 tier Dropdown menu</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/mvTS_YSSY1k/</link>
		<comments>http://www.intechgrity.com/itg-sexy-horizontal-1-tier-dropdown-menu/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 17:37:45 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=824</guid>
		<description><![CDATA[Well, it has been a while since we announced the long awaited come back of ours&#8230; But it&#8217;s never too late to start . So here we are with a new Free Project! I was going through some free psds of navigation menus. I found one really good and thought of converting it to a [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/jquery-powered-sidebar-navigation-menu/' rel='bookmark' title='jQuery Vertical Sidebar Navigation menu for your Blog or Website – Free package by iTg'>jQuery Vertical Sidebar Navigation menu for your Blog or Website – Free package by iTg</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/tMZuGcMGFKaxga-JLzNSwyEJWrc/0/da"><img src="http://feedads.g.doubleclick.net/~a/tMZuGcMGFKaxga-JLzNSwyEJWrc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/tMZuGcMGFKaxga-JLzNSwyEJWrc/1/da"><img src="http://feedads.g.doubleclick.net/~a/tMZuGcMGFKaxga-JLzNSwyEJWrc/1/di" border="0" ismap="true"></img></a></p><p><a href="http://www.intechgrity.com/wp-content/uploads/2011/06/sexy-itg-dropdown-menu.png"></a><a href="http://www.intechgrity.com/wp-content/uploads/2011/06/sexy-itg-dropdown-menu.png"><img class="aligncenter size-full wp-image-825" title="sexy itg dropdown menu" src="http://www.intechgrity.com/wp-content/uploads/2011/06/sexy-itg-dropdown-menu.png" alt="" width="591" height="399" /></a><br />
Well, it has been a while since we announced the long awaited come back of ours&#8230; But it&#8217;s never too late to start <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . So here we are with a new Free Project! I was going through some free psds of navigation menus. I found one really good and thought of converting it to a nicely coded CSS/XHTML menu. But I couldn&#8217;t stop myself and added a bit of animation using jQuery! Here you can find the demo and the as obvious the download package.<span id="more-824"></span></p>
<div class="demo-download"><a class="demo" href="http://demo.intechgrity.com/itg_sexy_dropdown/" target="_blank">Online Demo</a><a class="download" title="iTg Sexy 1 tier dropdown menu Downloaded 417" href="http://www.intechgrity.com/downloads/10">Download Now</a></div>
<p>All the necessary CSS, JS and XHTML files and image are included in the download package. Feel free if you wish to use this on your projects. Just include the copyright and license things <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>As for the designing, thanks to <a href="http://coregfx.org/tutorials/light-lime-and-blue-navigation/" target="_blank">COREGFX</a> for freely providing us the necessary psd file. I have just added the dropdown into the psd. In the next post I will discuss more about the how the code works.</p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/jquery-powered-sidebar-navigation-menu/' rel='bookmark' title='jQuery Vertical Sidebar Navigation menu for your Blog or Website – Free package by iTg'>jQuery Vertical Sidebar Navigation menu for your Blog or Website – Free package by iTg</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=mvTS_YSSY1k:tJfKezuN7MA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=mvTS_YSSY1k:tJfKezuN7MA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=mvTS_YSSY1k:tJfKezuN7MA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=mvTS_YSSY1k:tJfKezuN7MA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=mvTS_YSSY1k:tJfKezuN7MA:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=mvTS_YSSY1k:tJfKezuN7MA:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/mvTS_YSSY1k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/itg-sexy-horizontal-1-tier-dropdown-menu/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/itg-sexy-horizontal-1-tier-dropdown-menu/</feedburner:origLink></item>
		<item>
		<title>The evil spirits are back</title>
		<link>http://feedproxy.google.com/~r/greentechspot/~3/MOw3eDyERgk/</link>
		<comments>http://www.intechgrity.com/the-evil-spirits-are-back/#comments</comments>
		<pubDate>Thu, 05 May 2011 11:21:42 +0000</pubDate>
		<dc:creator>Swashata</dc:creator>
				<category><![CDATA[About]]></category>

		<guid isPermaLink="false">http://www.intechgrity.com/?p=817</guid>
		<description><![CDATA[Finally someone reincarnated the evil spirits&#8230; It&#8217;s been quite a long (really loong) we were caught inside the bottle, but now we are free again. And just like those old fairy tales, after such a long time of thrall, we have become more powerful and stronger. Yes! You have heard it right. We are now [...]
Related posts:<ol>
<li><a href='http://www.intechgrity.com/we-are-back-with-bang-top-commentator/' rel='bookmark' title='We are back with a bang – Top Commentator, Web Dev and Many More'>We are back with a bang – Top Commentator, Web Dev and Many More</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/9rVfE0V5CQUm-I7VErqRGuZqJYA/0/da"><img src="http://feedads.g.doubleclick.net/~a/9rVfE0V5CQUm-I7VErqRGuZqJYA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/9rVfE0V5CQUm-I7VErqRGuZqJYA/1/da"><img src="http://feedads.g.doubleclick.net/~a/9rVfE0V5CQUm-I7VErqRGuZqJYA/1/di" border="0" ismap="true"></img></a></p><p style="text-align: justify;"><a href="http://www.intechgrity.com/wp-content/uploads/2011/05/evil-sprit.jpg"><img class="alignright size-full wp-image-819" title="evil sprit" src="http://www.intechgrity.com/wp-content/uploads/2011/05/evil-sprit.jpg" alt="" width="289" height="400" /></a>Finally someone reincarnated the evil spirits&#8230; It&#8217;s been quite a long (really loong) we were caught inside the bottle, but now we are free again. And just like those old fairy tales, after such a long time of thrall, we have become more powerful and stronger.</p>
<p style="text-align: justify;">Yes! You have heard it right. We are now limited not only to WordPress&#8230; We have extended our knowledge to a better eCommerce platform, Open Cart. Thanks to our biggest client and hosting provider FlexiHost, we got chances to develop on Open Cart. So far we have made 4 Open Cart Modules and many small modifications. But this is just the beginning <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> &#8230; So its not far when you will see another category &#8220;Open Cart&#8221; here at iTg.</p>
<p style="text-align: justify;">We have a huge heap of drafts to complete and many requests to fulfill. We will try to deal with them as soon as possible&#8230;</p>
<p style="text-align: justify;">And lastly thanks a lot for supporting us even when we were not updating our blog. Our visitor count has increased a lot and also we have improved our Alexa Ranking without actually doing anything. This was possible just for your support. <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: justify;">Anyways, we are not going to waste much time here. Our next upcoming post is related to something which our visitors have requested most since a past few weeks. So stay tuned <img src='http://www.intechgrity.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Related posts:<ol>
<li><a href='http://www.intechgrity.com/we-are-back-with-bang-top-commentator/' rel='bookmark' title='We are back with a bang – Top Commentator, Web Dev and Many More'>We are back with a bang – Top Commentator, Web Dev and Many More</a></li>
</ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:nQ_hWtDbxek"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=nQ_hWtDbxek" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=MOw3eDyERgk:j5h2gZF26qY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=MOw3eDyERgk:j5h2gZF26qY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=MOw3eDyERgk:j5h2gZF26qY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=dnMXMwOfBR0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:YwkR-u9nhCs"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=YwkR-u9nhCs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/greentechspot?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=MOw3eDyERgk:j5h2gZF26qY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/greentechspot?a=MOw3eDyERgk:j5h2gZF26qY:-BTjWOF_DHI"><img src="http://feeds.feedburner.com/~ff/greentechspot?i=MOw3eDyERgk:j5h2gZF26qY:-BTjWOF_DHI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/greentechspot/~4/MOw3eDyERgk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.intechgrity.com/the-evil-spirits-are-back/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.intechgrity.com/the-evil-spirits-are-back/</feedburner:origLink></item>
	</channel>
</rss>

