<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming Ideas, Logics, Tips and Tricks &#187; source code</title>
	<atom:link href="http://www.sajithmr.me/tag/source-code/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sajithmr.me</link>
	<description></description>
	<lastBuildDate>Mon, 23 Jan 2012 15:44:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Algorithm for range of dates</title>
		<link>http://www.sajithmr.me/algorithm-for-range-of-dates</link>
		<comments>http://www.sajithmr.me/algorithm-for-range-of-dates#comments</comments>
		<pubDate>Wed, 12 May 2010 12:22:08 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[from date]]></category>
		<category><![CDATA[last 7 days]]></category>
		<category><![CDATA[last month]]></category>
		<category><![CDATA[last quarter]]></category>
		<category><![CDATA[last week]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[this month]]></category>
		<category><![CDATA[this quarter]]></category>
		<category><![CDATA[this week]]></category>
		<category><![CDATA[this year]]></category>
		<category><![CDATA[to date]]></category>
		<category><![CDATA[today]]></category>
		<category><![CDATA[yesterday]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=691</guid>
		<description><![CDATA[Here is a php function which returns from and to date as an array for a range: &#60;?php function get_rangeof_dates($time_frame = &#8216;all_time&#8217;) { $from_date = &#8221;; $to_date = &#8221;; switch($time_frame) { case &#8216;all_time&#8217;:        $from_date = &#8217;1170-01-01 00:00:00&#8242;; $to_date = &#8217;2250-12-31 23:59:59&#8242;; break; case &#8216;today&#8217;: $from_date = date(&#8216;Y-m-d 00:00:00&#8242;); $to_date = date(&#8216;Y-m-d 23:59:59&#8242;); [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-709" title="calendar-icon" src="http://www.sajithmr.me/wp-content/uploads/2010/05/calendar-icon.png" alt="calendar-icon" width="256" height="256" /></p>
<p>Here is a php function which returns from and to date as an array for a range:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;"><span style="color: #000000;"><span style="color: #bf2e9d;">function</span> get_rangeof_dates($time_frame = <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;all_time&#8217;</span>)</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = <span style="font: 11.0px Menlo; color: #2832cf;">&#8221;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = <span style="font: 11.0px Menlo; color: #2832cf;">&#8221;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"><span style="white-space: normal;"><span style="color: #bf2e9d;">switch</span>($time_frame)</span></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #2832cf;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #bf2e9d;">case</span><span style="color: #000000;"> </span><span style="font: 11.0px Menlo;">&#8216;all_time&#8217;</span><span style="color: #000000;">:        $from_date = </span><span style="font: 11.0px Menlo;">&#8217;1170-01-01 00:00:00&#8242;</span><span style="color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span>$to_date = </span>&#8217;2250-12-31 23:59:59&#8242;<span style="font: 12.0px Menlo; color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #2832cf;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span><span style="color: #bf2e9d;">case</span><span style="color: #000000;"> </span><span style="font: 11.0px Menlo;">&#8216;today&#8217;</span><span style="color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;yesterday&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>, time()- <span style="font: 11.0px Menlo; color: #2832cf;">24</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>, time()- <span style="font: 11.0px Menlo; color: #2832cf;">24</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;this_week&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>, time() &#8211; (date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;w&#8217;</span>, time()) * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span>));</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>, time() + ((<span style="font: 11.0px Menlo; color: #2832cf;">6</span> &#8211; date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;w&#8217;</span>, time())) * <span style="font: 11.0px Menlo; color: #2832cf;">60</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span> ));</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;last_week&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>, time() &#8211; (date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;w&#8217;</span>, time()) * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span>) &#8211; <span style="font: 11.0px Menlo; color: #2832cf;">7</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>, time() + (( <span style="font: 11.0px Menlo; color: #2832cf;">6</span> &#8211; date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;w&#8217;</span>, time()) ) * <span style="font: 11.0px Menlo; color: #2832cf;">60</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span> ) &#8211; <span style="font: 11.0px Menlo; color: #2832cf;">7</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">case</span> <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;last_7_days&#8217;</span>:     $additonal_query = <span style="font: 11.0px Menlo; color: #d62b24;">&#8220;created_at &gt; &#8216;&#8221;</span>.date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d&#8217;</span>, time()- <span style="font: 11.0px Menlo; color: #2832cf;">7</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> )<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #d62b24;">&#8220;&#8216;&#8221;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>, time()- <span style="font: 11.0px Menlo; color: #2832cf;">7</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;this_month&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>, mktime( <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;m&#8221;</span>)  , <span style="font: 11.0px Menlo; color: #2832cf;">1</span> , date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y&#8221;</span>) ) );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;last_month&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y-m-01 00:00:00&#8243;</span>, strtotime(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;-1 month&#8221;</span>, strtotime(date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y-m-d&#8221;</span>))));</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y-m-d 23:59:59&#8243;</span>, strtotime(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;-1 day&#8221;</span>, strtotime(date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y-m-01&#8243;</span>))));</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;last_30_days&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 00:00:00&#8242;</span>, time()- <span style="font: 11.0px Menlo; color: #2832cf;">30</span> * <span style="font: 11.0px Menlo; color: #2832cf;">24</span>* <span style="font: 11.0px Menlo; color: #2832cf;">60</span> * <span style="font: 11.0px Menlo; color: #2832cf;">60</span> );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-m-d 23:59:59&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;this_quarter&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$month = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;m&#8217;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$year = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y&#8217;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">if</span>($month == <span style="font: 11.0px Menlo; color: #2832cf;">1</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">2</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">3</span> )</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-01-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-03-31&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">elseif</span>($month == <span style="font: 11.0px Menlo; color: #2832cf;">4</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">5</span>|| $month == <span style="font: 11.0px Menlo; color: #2832cf;">6</span> )</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-04-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-06-30&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">elseif</span>($month == <span style="font: 11.0px Menlo; color: #2832cf;">7</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">8</span>|| $month == <span style="font: 11.0px Menlo; color: #2832cf;">9</span> )</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-07-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-09-30&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">else</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-10-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-12-31&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;last_quarter&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$month = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;m&#8217;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$year = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y&#8217;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">if</span>($month == <span style="font: 11.0px Menlo; color: #2832cf;">1</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">2</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">3</span> )</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = ($year -<span style="font: 11.0px Menlo; color: #2832cf;">1</span>)<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-10-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = ($year-<span style="font: 11.0px Menlo; color: #2832cf;">1</span>)<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-12-31&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">elseif</span>($month == <span style="font: 11.0px Menlo; color: #2832cf;">4</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">5</span>|| $month == <span style="font: 11.0px Menlo; color: #2832cf;">6</span> )</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-01-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-03-31&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">elseif</span>($month == <span style="font: 11.0px Menlo; color: #2832cf;">7</span> || $month == <span style="font: 11.0px Menlo; color: #2832cf;">8</span>|| $month == <span style="font: 11.0px Menlo; color: #2832cf;">9</span> )</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-04-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-06-30&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">else</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-07-01&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = $year<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">&#8216;-09-30&#8242;</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;this_year&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-01-01 00:00:00&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-12-31 23:59:59&#8242;</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">case</span><span style="font: 12.0px Menlo; color: #000000;"> </span>&#8216;last_year&#8217;<span style="font: 12.0px Menlo; color: #000000;">:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$from_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-01-01 00:00:00&#8242;</span>, mktime( <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">01</span> , <span style="font: 11.0px Menlo; color: #2832cf;">01</span> , date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y&#8221;</span>) &#8211; <span style="font: 11.0px Menlo; color: #2832cf;">1</span> ));</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$to_date = date(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;Y-12-31 23:59:59&#8242;</span>, mktime( <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">0</span>, <span style="font: 11.0px Menlo; color: #2832cf;">12</span> , <span style="font: 11.0px Menlo; color: #2832cf;">31</span> , date(<span style="font: 11.0px Menlo; color: #d62b24;">&#8220;Y&#8221;</span>) &#8211; <span style="font: 11.0px Menlo; color: #2832cf;">1</span> ) );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">break</span>;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">return</span> <span style="color: #bf2e9d;">array</span>($from_date, $to_date);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;"><span style="color: #000000;"><span style="white-space: pre;"> </span></span>?&gt;</p>
<div><span style="font-family: Menlo, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #bf2e9d; font-size: small;"><span style="line-height: normal;"><br />
</span></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/algorithm-for-range-of-dates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook application development &#8211; Quick note</title>
		<link>http://www.sajithmr.me/facebook-application-development-quick-note</link>
		<comments>http://www.sajithmr.me/facebook-application-development-quick-note#comments</comments>
		<pubDate>Wed, 05 May 2010 23:37:54 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[public key]]></category>
		<category><![CDATA[publish]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[wall]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=675</guid>
		<description><![CDATA[This is a quick note for myself to remember some tricks while we develop a Facebook application. If you are a beginner in Facebook application development, go here first. If  you an expert in Facebook development, go here. The steps in creating a facebook app. 1) Register an application in facebook 2) Add Canvas URL [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-676" title="facebook_f" src="http://www.sajithmr.me/wp-content/uploads/2010/05/facebook_f.jpg" alt="facebook_f" width="187" height="187" /></p>
<p>This is a quick note for myself to remember some tricks while we develop a Facebook application.</p>
<p>If you are a beginner in Facebook application development, go <a href="http://developers.facebook.com/docs/guides/canvas/" target="_blank">here</a> first.</p>
<p>If  you an expert in Facebook development, go <a href="http://gizmodo.com/5530178/top-ten-reasons-you-should-quit-facebook" target="_blank">here</a>. <img src='http://www.sajithmr.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">The steps in creating a facebook app.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1) Register an application in facebook</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2) Add Canvas URL</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3) Add Canvas Callback url</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">4) Test the canvas is working or not</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">To execute FBML inside your code (for iframe), you must add FBConnect URL</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">You need to set xd_receiver.htm in your webroot folder</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Download facebook php api</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If you are using iframe, remember to use facebook-canvas url for links and forms , not your local url.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">If you are using canvas mode, you cannot use body tag in your html. You dont need to keep the basic html layout</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">like head, title, body etc</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">An example page in the canvas_callback looks like this:</div>
<p>The steps in creating a facebook app.</p>
<p><span style="color: #800000;"><strong>1) Register an application in facebook</strong></span></p>
<p><span style="color: #800000;"><strong>2) Add Canvas URL</strong></span></p>
<p><span style="color: #800000;"><strong>3) Add Canvas Callback url</strong></span></p>
<p><span style="color: #800000;"><strong>4) Test the canvas is working or not</strong></span></p>
<p>To execute FBML inside your code (for iframe), you must add <a href="http://developers.facebook.com.iproxy.saverpigeeks.com//docs/guides/web" target="_blank">FBConnect</a> URL</p>
<p>You need to set <a href="http://wiki.developers.facebook.com/index.php/Cross_Domain_Communication_Channel" target="_blank">xd_receiver.htm</a> in your webroot folder</p>
<p>Download facebook <a href="http://github.com/facebook/php-sdk" target="_blank">php api</a></p>
<p>If you are using iframe, remember to use facebook-canvas url for links and forms , not your local url.</p>
<p>If you are using canvas mode, you cannot use body tag in your html. You dont need to keep the basic html layout</p>
<p>like head, title, body etc</p>
<p>An example page in the canvas_callback looks like this:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #2832cf"><span style="color: #bf2e9d">require_once</span><span style="color: #000000">(</span><span style="font: 11.0px Menlo">&#8216;facebook.php&#8217;</span><span style="color: #000000">);</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #008326">//ini_set (&#8216;display_errors&#8217;, 1);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf"><span style="font: 12.0px Menlo; color: #000000">$appapikey = </span>&#8217;0d7c64e9a387eXXXXXXXXXXXXXXXXXXX&#8217;<span style="font: 12.0px Menlo; color: #000000">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf"><span style="font: 12.0px Menlo; color: #000000">$appsecret = </span>&#8217;9fc9eef6dXXXXXXXXXXXXXXXXXXXXXXX&#8217;<span style="font: 12.0px Menlo; color: #000000">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">$facebook = <span style="color: #bf2e9d">new</span> Facebook($appapikey, $appsecret);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">?&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">
<p style="font: normal normal normal 12px/normal Menlo; margin: 0px;"><span style="color: #000000;"><br />
</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">
<p style="font: normal normal normal 12px/normal Menlo; margin: 0px;"><span style="color: #000000;">Sometimes , in IE and Safari, infinite redirect loop will happen. It is due to session problem</span></p>
<p style="font: normal normal normal 12px/normal Menlo; margin: 0px;"><span style="color: #000000;">add the below code to solve this!</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$prefix = ($_REQUEST[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_sig_user'</span>]) ? <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;fb_sig&#8217;</span> : $appapikey;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="color: #bf2e9d;">if</span>( <span style="color: #bf2e9d;">isset</span>($_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_session_key'</span>]) ){</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">session_name( $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_session_key'</span>] );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">session_start();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$_SESSION[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_user'</span>]        = $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_user'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$_SESSION[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_session_key'</span>] = $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_session_key'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$_SESSION[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_expires'</span>]     = $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_expires'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$_SESSION[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_in_canvas'</span>]   = $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_in_canvas'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$_SESSION[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_time'</span>]        = $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_time'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"> $_SESSION[</span>'fb_profile_update_time'<span style="font: 12.0px Menlo; color: #000000;">] = $_REQUEST[$prefix</span><span style="font: 12.0px Menlo; color: #bf2e9d;">.</span>'_profile_update_time'<span style="font: 12.0px Menlo; color: #000000;">];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">$_SESSION[<span style="font: 11.0px Menlo; color: #2832cf;">'fb_api_key'</span>]     = $_REQUEST[$prefix<span style="color: #bf2e9d;">.</span><span style="font: 11.0px Menlo; color: #2832cf;">'_api_key'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">} <span style="color: #bf2e9d;">else</span> {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #008326;"><span style="color: #000000;"> </span>// Just so there *is* a session for times when there is no fb session</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">session_start();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">?&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;"><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">If you use iframe, remember to use this funcion as well</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;"><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"><br />
</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;"><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo"><span style="white-space: pre;"> </span>$facebook-&gt;require_frame();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">?&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d"><span style="color: #000000; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">Also use the following function if you need authentication</span></p>
<p>$user_id = $facebook-&gt;require_login();</p>
<p>Don&#8217;t forget to add this in html tag (for iframe users)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d62b24"><span style="font: 12.0px Menlo; color: #000000;">&lt;html xmlns=</span>&#8220;http://www.w3.org/1999/xhtml&#8221;<span style="font: 12.0px Menlo; color: #000000;"> xmlns:fb=</span>&#8220;http://www.facebook.com/2008/fbml&#8221;<span style="font: 12.0px Menlo; color: #000000;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d62b24">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d62b24"><span style="font: 12.0px Menlo; color: #000000;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">For facebook client side api (Javascript), include this line</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #1440f5"><span style="font: 12.0px Menlo; color: #bf2e9d;">&lt;script </span><span style="color: #977d40;">type</span><span style="font: 12.0px Menlo; color: #bf2e9d;">=</span><span style="color: #d62b24;">&#8220;text/javascript&#8221;</span><span style="font: 12.0px Menlo; color: #bf2e9d;"> </span><span style="color: #977d40;">src</span><span style="font: 12.0px Menlo; color: #bf2e9d;">=</span><span style="color: #d62b24;">&#8220;<a href="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"><span style="color: #1440f5;">http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php</span></a>&#8220;</span><span style="font: 12.0px Menlo; color: #bf2e9d;">&gt;&lt;/script&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">For example, if you need to open a add to bookmark dialog on button click, use:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">onclick=&#8221;FB.Connect.showBookmarkDialog();&#8221;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">Add this line very bottom of the page, to avoid javascript error in some browsers (IE6 or 7 not sure)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d62b24"><span style="font: 12.0px Menlo; color: #bf2e9d;">&lt;div </span><span style="color: #977d40;">id</span><span style="font: 12.0px Menlo; color: #bf2e9d;">=</span>&#8220;FB_HiddenIFrameContainer&#8221;<span style="font: 12.0px Menlo; color: #bf2e9d;"> </span><span style="color: #977d40;">style</span><span style="font: 12.0px Menlo; color: #bf2e9d;">=</span>&#8220;display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;&#8221;<span style="font: 12.0px Menlo; color: #bf2e9d;">&gt;&lt;/div&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">Sometimes, your application inside iframe shows scroll bar. It is due to dynamically increasing height or width of the content</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">use the below script at the bottom of the page.</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d62b24"><span style="font: 12.0px Menlo; color: #bf2e9d;">&lt;script </span><span style="color: #977d40;">type</span><span style="font: 12.0px Menlo; color: #bf2e9d;">=</span>&#8220;text/javascript&#8221;<span style="font: 12.0px Menlo; color: #bf2e9d;">&gt;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">window.onload = <span style="color: #bf2e9d;">function</span>() {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">FB_RequireFeatures([<span style="font: 11.0px Menlo; color: #d62b24;">"XFBML"</span>, <span style="font: 11.0px Menlo; color: #d62b24;">"Connect"</span>], <span style="color: #bf2e9d;">function</span>() {</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d62b24"><span style="font: 12.0px Menlo; color: #000000;"> FB.init(</span>&#8220;0d7c64e9a387XXXXXXXXXXXX&#8221;<span style="font: 12.0px Menlo; color: #000000;">, </span><span style="color: #2832cf;">&#8216;xd_receiver.htm&#8217;</span><span style="font: 12.0px Menlo; color: #000000;">);</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">FB.CanvasClient.startTimerToSizeToContent();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">FB.CanvasClient.syncUrl();</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">});</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">};</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d"><span style="color: #000000;"> </span>&lt;/script&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">Look  inside the facebook api php file to know more about the functions. For example to get friends info</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: small;"><span style="line-height: 19px;"> </span></span></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: small;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo"><span style="white-space: pre;"> </span>$friends = $facebook-&gt;api_client-&gt;friends_get(<span style="font: 11.0px Menlo; color: #2832cf;">&#8221;</span>,$user_id);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo"><span style="white-space: pre;"> </span>$friends_info = $facebook-&gt;api_client-&gt;users_getInfo(implode(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;,&#8217;</span>, $friends), <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;first_name,last_name,pic_square &#8216;</span> );</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d">?&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #000000; font-size: small;"><span style="line-height: 19px;"><span style="font-family: Menlo, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #bf2e9d; font-size: small;"><span style="line-height: normal;"><br />
</span></span></span></span></p>
<p>For ajax call inside your iframe, to avoid redirect loop, pass the full server query url along with your file.</p>
<p>&lt;?=$_SERVER['QUERY_STRING']?&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">eg:</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;">$(</span>&#8216;#browse_ajax&#8217;<span style="font: 12.0px Menlo; color: #000000;">).load(</span>&#8216;&lt;?=$root_path?&gt;browse_ajax.php?&lt;?=$_SERVER['<span style="font: 12.0px Menlo; color: #000000;">QUERY_STRING</span>']?&gt;&#8217;<span style="font: 12.0px Menlo; color: #000000;">);</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">When you pass Query <span style="color: #bf2e9d;">string</span>, remember to replace your parameters passing via get method<span style="color: #bf2e9d;">.</span> Otherwise</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">you cannot pass yourown custom values</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">function</span> get_query_string()</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$serverQuery = $_SERVER[<span style="font: 11.0px Menlo; color: #2832cf;">'QUERY_STRING'</span>];</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$serverQuery=  str_replace(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;page=&#8217;</span>, <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;page_=&#8217;</span>, $serverQuery);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$serverQuery = str_replace(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;fan=&#8217;</span>, <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;fan_=&#8217;</span>, $serverQuery);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>$serverQuery = str_replace(<span style="font: 11.0px Menlo; color: #2832cf;">&#8216;uid=&#8217;</span>, <span style="font: 11.0px Menlo; color: #2832cf;">&#8216;uid_=&#8217;</span>, $serverQuery);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span><span style="color: #bf2e9d;">return</span> $serverQuery;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">?&gt;</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">&lt;?php</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="color: #008326;">Use the below function for publish to wall option:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="color: #bf2e9d;">function</span> publishWall()</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;"><span style="white-space: pre;"> </span>{</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">var</span><span style="font: 12.0px Menlo; color: #000000;"> message = </span>&#8216;type your message here&#8217;<span style="font: 12.0px Menlo; color: #000000;">;</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #000000;"><span style="white-space: pre;"> </span></span><span style="font: 12.0px Menlo; color: #bf2e9d;">var</span><span style="font: 12.0px Menlo; color: #000000;"> attachment = { </span>&#8216;name&#8217;<span style="font: 12.0px Menlo; color: #000000;">: </span>&#8216;your text here&#8217;<span style="font: 12.0px Menlo; color: #000000;">, </span>&#8216;href&#8217;<span style="font: 12.0px Menlo; color: #000000;">: </span>&#8216;http://urlhere.com/&#8217;<span style="font: 12.0px Menlo; color: #000000;">, </span>&#8216;description&#8217;<span style="font: 12.0px Menlo; color: #000000;">: </span>&#8216;Your message here&#8217;<span style="font: 12.0px Menlo; color: #000000;">, </span>&#8216;media&#8217;<span style="font: 12.0px Menlo; color: #000000;">: [{ </span>'type'<span style="font: 12.0px Menlo; color: #000000;">: </span>'image'<span style="font: 12.0px Menlo; color: #000000;">, </span>'src'<span style="font: 12.0px Menlo; color: #000000;">: </span>'urlhere.com', '<span style="font: 12.0px Menlo; color: #000000;">href</span>': '<span style="font: 12.0px Menlo; color: #008326;"><span style="color: #2832cf; font-size: 11px;">urlhere.com</span>'}] };</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #2832cf;"><span style="font: 12.0px Menlo; color: #bf2e9d;">var</span><span style="font: 12.0px Menlo; color: #000000;"> action_links = [{</span>'text'<span style="font: 12.0px Menlo; color: #000000;">:</span>'More like this'<span style="font: 12.0px Menlo; color: #000000;">, </span>'href'<span style="font: 12.0px Menlo; color: #000000;">:</span>'urlhere.com'<span style="font: 12.0px Menlo; color: #000000;">}];</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">FB.Connect.streamPublish(message, attachment, action_links);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo;">}</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;">
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; min-height: 14.0px;"><span style="white-space: pre;"> </span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #bf2e9d;">?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/facebook-application-development-quick-note/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sliding menu using jQuery and ScrollTo</title>
		<link>http://www.sajithmr.me/sliding-menu-using-jquery-and-scrollto</link>
		<comments>http://www.sajithmr.me/sliding-menu-using-jquery-and-scrollto#comments</comments>
		<pubDate>Sat, 20 Feb 2010 21:38:53 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[scroll]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.sajithmr.me/?p=583</guid>
		<description><![CDATA[Recently I created a sliding menu for a project using jQuery and ScrollTo functions. See demo: Slider  Menu We can use the jQuery function $(&#8220;.menubar&#8221;).scrollTo(id_of_element) to scroll any scrollable area to a particular location. The idea behind every smooth sliding is using scroll function with overflow:hidden mode. You can download the source code from : [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-584" title="jquery-logo" src="http://www.sajithmr.me/wp-content/uploads/2010/02/jquery-logo.gif" alt="jquery-logo" width="168" height="146" /></p>
<p>Recently I created a sliding menu for a project using jQuery and ScrollTo functions.</p>
<p>See demo: <a href="http://www.sajithmr.me/downloads/slider/slider.html" target="_blank">Slider  Menu</a></p>
<p>We can use the jQuery function $(&#8220;.menubar&#8221;).scrollTo(id_of_element) to scroll any scrollable area to a particular location.</p>
<p>The idea behind every smooth sliding is using scroll function with overflow:hidden mode.</p>
<p>You can download the source code from : <a href="http://www.sajithmr.me/downloads/slider/slider.zip" target="_self">http://www.sajithmr.me/downloads/slider/slider.zip</a></p>
<p>Here div menu-bar is the scrollable div with overflow:hidden mode contains set of menu and a duplicate as a  buffer</p>
<p>At the bottom of the code, you can see a filler div, this is for filling the menu one by one to the right side menu-bar to make the sliding very smooth</p>
<p>The function setMotion(this) calls  the scroll function and it moves till the called DOM object&#8217;s id reaches</p>
<p>If you use an ajax call after the motion to load the content at the bottom, you can make this sliding menu for proper navigation purpose.</p>
<p>Thanks</p>
<p>Sajith</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/sliding-menu-using-jquery-and-scrollto/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Jmail++ , My Final Year Project</title>
		<link>http://www.sajithmr.me/jmail-my-final-year-project</link>
		<comments>http://www.sajithmr.me/jmail-my-final-year-project#comments</comments>
		<pubDate>Mon, 14 Apr 2008 11:24:05 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[webworld]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[jmail]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[pop3]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/jmail-my-final-year-project/</guid>
		<description><![CDATA[I am writing this topic in sajithmr.com, because i am getting a lot of queries regarding this project from the place I submitted , ProjectGuidance.com , 3 years back. It was a new Webmail Service Idea Developed in JSP . Here is the link. http://www.projectguidance.com/guidance/details/id/36676649 . There are more than 400 replies and most of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/04/logo.jpg" alt="Jmail++ Logo" style="margin: 10px; float: left" />I am writing this topic in sajithmr.com, because  i am getting a lot of queries regarding this project  from the place I submitted , <a href="http://www.projectguidance.com">ProjectGuidance.com</a> ,  3 years back.  It was a new Webmail Service Idea Developed in JSP . Here is the link. <a href="http://www.projectguidance.com/guidance/details/id/36676649" title="A new Webmail - JSP">http://www.projectguidance.com/guidance/details/id/36676649</a> .</p>
<p>There are more than 400 replies and most of its content is &#8220;please send me the project report to my email address&#8221;.</p>
<blockquote><p>jMail++ is a webmail written in JSP. You can create new Account here like yahoo, gmail etc&#8230;The Session is handled by Single page Auto Invalidate Method..That will increase Your Mail Security. A simple 4 entry Registration process is required.. And your Password will be handle using RSA Encryption method&#8230;There is a Fast Search Mechanism included with Google APIs. The Very Important and Unique Feature is You can Check Your Rediff, Hotmail , Gmail account from this Webmail without login into the respective sites. It means this Webpage act as an Email Client Also (Like OutLook Express). The Protocols (SMTP,POP3) all are implement from Scrach without any API&#8217;s&#8230;Its is a Pure JSP Project.</p></blockquote>
<p>This was the post on <a href="http://www.projectguidance.com">ProjectGuidance.com</a></p>
<p>Here i included the full project report as zip file.</p>
<p><a href="http://www.sajithmr.com/downloads/Jmail-Project-Report.zip" title="Jmail Project Report">Jmail-Project-Report.zip</a></p>
<p><a href="http://www.sajithmr.com/downloads/Jmail-Project-Report.zip" title="Jmail Project Report"><img src="http://www.sajithmr.com/wp-content/uploads/2008/04/winzip_180x180.thumbnail.gif" alt="OpenID Integration PHP" width="73" height="73" /></a></p>
<p>See screen short of this project:</p>
<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/04/homescreen.jpg" alt="Jmail Screen Shot 1" /><br />
(Screenshot 1)</p>
<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/04/composescreen.jpg" alt="Jmail Screen Shot 2" /><br />
(Screen shot 2)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/jmail-my-final-year-project/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>PHP post without curl</title>
		<link>http://www.sajithmr.me/php-post-without-curl</link>
		<comments>http://www.sajithmr.me/php-post-without-curl#comments</comments>
		<pubDate>Fri, 04 Apr 2008 05:07:59 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/php-post-without-curl/</guid>
		<description><![CDATA[You can simulate the post method using php without the help of curl library. download full source code: See the code below: function do_post_request($url, $data, $optional_headers = null) { $params = array('http' =&#62;; array('method' =&#62;; 'POST', 'content' =&#62;; $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, [...]]]></description>
			<content:encoded><![CDATA[<p>You can simulate the post method using php without the help of curl library.<br />
download full source code:<br />
<a href="http://www.sajithmr.com/downloads/post_without_curl.zip"><img src="http://www.sajithmr.com/wp-content/uploads/2008/04/winzip_180x180.thumbnail.gif" alt="OpenID Integration PHP" width="42" height="42" /></a></p>
<p>See the code below:</p>
<pre line="1" lang="php">
function do_post_request($url, $data, $optional_headers = null) {

$params = array('http' =&gt;; array('method' =&gt;; 'POST',

'content' =&gt;; $data

));

if ($optional_headers !== null) {

$params['http']['header'] = $optional_headers;

}

$ctx = stream_context_create($params);

$fp = @fopen($url, 'rb', false, $ctx);

if (!$fp) {

throw new Exception("Problem with $url, $php_errormsg");

}

$response = @stream_get_contents($fp);

if ($response === false) {

throw new Exception("Problem reading data from $url, $php_errormsg");

}

return $response;

}

?&gt;</pre>
<p>Download the full source code from <a href="http://www.sajithmr.com/downloads/post_without_curl.zip" target="_blank">post_without_curl.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/php-post-without-curl/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>OpenID Integration PHP</title>
		<link>http://www.sajithmr.me/openid-integration-php</link>
		<comments>http://www.sajithmr.me/openid-integration-php#comments</comments>
		<pubDate>Thu, 03 Apr 2008 09:01:21 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[webworld]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[openid]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/openid-integration-php/</guid>
		<description><![CDATA[I think you know the use of OpenID. Else go here and learn http://en.wikipedia.org/wiki/OpenID http://openid.net/what/ http://openiddirectory.com/ In a nutshell, the OpenID technology makes life simpler by having only one username and password to remember &#8211; yahoo OpenID tour Here the php source code for integrating your site with OpenID. If you have a website which [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/04/openidgif.png" alt="OpenID PHP Integration" width="528" height="176" /></p>
<p>I think you know the use of OpenID. Else go here and learn</p>
<p><a href="http://en.wikipedia.org/wiki/OpenID" target="_blank">http://en.wikipedia.org/wiki/OpenID</a><br />
<a href="http://openid.net/what/" target="_blank">http://openid.net/what/</a><br />
<a href="http://openiddirectory.com/" target="_blank">http://openiddirectory.com/</a></p>
<blockquote><p>In a nutshell, the OpenID technology makes life simpler by having only one username and password to remember &#8211; yahoo OpenID tour</p></blockquote>
<p>Here the php source code for integrating your site with OpenID. If you have a website which has user login / signup options , you can also add openID authentication so that user can login into your site with there OpenID</p>
<p><a title="Php OpenID Integration" href="http://www.sajithmr.me/downloads/php-openid-2.0.zip" target="_blank">php-openid-2.0.zip </a></p>
<p><a href="http://www.sajithmr.me/downloads/php-openid-2.0.zip" target="_blank"><img src="http://www.sajithmr.me/wp-content/uploads/2008/04/winzip_180x180.gif" alt="OpenID Integration PHP" /></a></p>
<p>(tested in windows. read the README file before installing. set $store_path = &#8220;/tmp&#8221; to a directory according to OS)</p>
<p>Visit this url: <a href="http://openidenabled.com/" target="_blank">http://openidenabled.com/</a> for other languages (phython, ruby etc)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/openid-integration-php/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>ffmpeg sample code</title>
		<link>http://www.sajithmr.me/ffmpeg-sample-code</link>
		<comments>http://www.sajithmr.me/ffmpeg-sample-code#comments</comments>
		<pubDate>Tue, 12 Jun 2007 15:12:02 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/?p=10</guid>
		<description><![CDATA[Install ffmpeg library in your server first. Place a video file of any type on current directory (or anywhere), here it is clock.avi . Click more for source code: extension_loaded('ffmpeg') or die('Error in loading ffmpeg'); $ffmpegInstance = new ffmpeg_movie('clock.avi'); echo "getDuration: " . $ffmpegInstance-&#62;getDuration() . "getFrameCount: " . $ffmpegInstance-&#62;getFrameCount() . "getFrameRate: " . $ffmpegInstance-&#62;getFrameRate() . [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-753" title="ffmpeg" src="http://www.sajithmr.me/wp-content/uploads/2007/06/ffmpeg.jpg" alt="ffmpeg" width="128" height="32" /></p>
<p>Install ffmpeg library in your server first.</p>
<p>Place a video file of any type on current directory (or anywhere), here it is clock.avi .</p>
<p>Click more for source code:</p>
<pre lang="php">extension_loaded('ffmpeg') or die('Error in loading ffmpeg');

$ffmpegInstance = new ffmpeg_movie('clock.avi');
echo "getDuration: " . $ffmpegInstance-&gt;getDuration() .
"getFrameCount: " . $ffmpegInstance-&gt;getFrameCount() .
"getFrameRate: " . $ffmpegInstance-&gt;getFrameRate() .
"getFilename: " . $ffmpegInstance-&gt;getFilename() .
"getComment: " . $ffmpegInstance-&gt;getComment() .
"getTitle: " . $ffmpegInstance-&gt;getTitle() .
"getAuthor: " . $ffmpegInstance-&gt;getAuthor() .
"getCopyright: " . $ffmpegInstance-&gt;getCopyright() .
"getArtist: " . $ffmpegInstance-&gt;getArtist() .
"getGenre: " . $ffmpegInstance-&gt;getGenre() .
"getTrackNumber: " . $ffmpegInstance-&gt;getTrackNumber() .
"getYear: " . $ffmpegInstance-&gt;getYear() .
"getFrameHeight: " . $ffmpegInstance-&gt;getFrameHeight() .
"getFrameWidth: " . $ffmpegInstance-&gt;getFrameWidth() .
"getPixelFormat: " . $ffmpegInstance-&gt;getPixelFormat() .
"getBitRate: " . $ffmpegInstance-&gt;getBitRate() .
"getVideoBitRate: " . $ffmpegInstance-&gt;getVideoBitRate() .
"getAudioBitRate: " . $ffmpegInstance-&gt;getAudioBitRate() .
"getAudioSampleRate: " . $ffmpegInstance-&gt;getAudioSampleRate() .
"getVideoCodec: " . $ffmpegInstance-&gt;getVideoCodec() .
"getAudioCodec: " . $ffmpegInstance-&gt;getAudioCodec() .
"getAudioChannels: " . $ffmpegInstance-&gt;getAudioChannels() .
"hasAudio: " . $ffmpegInstance-&gt;hasAudio();</pre>
<p>//___________________________________Code end here_____________________________________</p>
<p>I also can be used for file format conversion</p>
<p>Eg: exec(&#8216;ffmpeg -i &#8216;.$SourcePath.&#8217; &#8216;.$Destination);</p>
<p>Here $SourcePath any file of any format , and destionation also another format.</p>
<p>eg: exec(&#8216;ffmpeg -i saji.3gp saji.flv&#8217;);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/ffmpeg-sample-code/feed</wfw:commentRss>
		<slash:comments>95</slash:comments>
		</item>
	</channel>
</rss>

