<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mesmerizing Moments | sarathdr.com</title>
	
	<link>http://www.sarathdr.com</link>
	<description>Mesmerizing Moments........</description>
	<lastBuildDate>Mon, 23 Jan 2012 15:33:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/sarathdr" /><feedburner:info uri="sarathdr" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>sarathdr</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Trip to Scotland</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/rBgmppt53rM/</link>
		<comments>http://www.sarathdr.com/2011/11/16/trip-to-scotland/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 23:53:05 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[sarath]]></category>
		<category><![CDATA[scotland]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=468</guid>
		<description><![CDATA[Last weekend had a nice trip to Scotland. We planned go by bus then later decided to go in train. It was amazing to see the scenic greenery which I thought I could find it only in my sweetest home land.]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<div id="attachment_472" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0068-1.jpg"><img class="size-full wp-image-472" title="Falling yet beautiful " src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0068-1.jpg" alt="Falling yet beautiful " width="500" height="332" /></a><p class="wp-caption-text">Falling yet beautiful</p></div>
<p>Last weekend had a nice trip to Scotland. We planned go by bus then later decided to go by train. It was amazing to see the scenic greenery which I thought I could find it only in my sweetest home land. The creativity of the world is endless and I wish I would be able to see as much as I can in my short life span <img src='http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=.sarathdr.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Even if it was very cold compared to London we enjoyed the whole trip and never missed to have a cold stream bath in -1 degree <img src='http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=.sarathdr.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<div id="attachment_480" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0050-1.jpg"><img class="size-full wp-image-480" title="Spring left me floating" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0050-1.jpg" alt="Spring left me floating" width="500" height="332" /></a><p class="wp-caption-text">Spring left me floating</p></div>
<p>&nbsp;</p>
<div id="attachment_481" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0063-1.jpg"><img class="size-full wp-image-481" title="Sorrow and gladness are linked together" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0063-1.jpg" alt="Sorrow and gladness are linked together" width="500" height="332" /></a><p class="wp-caption-text">Sorrow and gladness are linked together</p></div>
<div id="attachment_482" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0261-1.jpg"><img class="size-full wp-image-482" title="Macro" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC0261-1.jpg" alt="Macro" width="500" height="338" /></a><p class="wp-caption-text">Macro</p></div>
<div id="attachment_483" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/hdrversion-1.jpg"><img class="size-full wp-image-483" title="Hdr View " src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/hdrversion-1.jpg" alt="Hdr View " width="500" height="332" /></a><p class="wp-caption-text">Hdr View</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/11/16/trip-to-scotland/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/11/16/trip-to-scotland/</feedburner:origLink></item>
		<item>
		<title>Snaps from Brighton</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/WoPQFzl9yew/</link>
		<comments>http://www.sarathdr.com/2011/11/01/snaps-from-brighton/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 23:36:22 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[brighton]]></category>
		<category><![CDATA[brighton beach]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[motorist]]></category>
		<category><![CDATA[street light]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=457</guid>
		<description><![CDATA[It was a long term wish to visit Brighton since I landed London. It never happened in summer time even though planned several times with wife to go there. Last Sunday decided to go Brighton with one of my best friends without any plans. It was a nice trip rather than expected.]]></description>
			<content:encoded><![CDATA[<p>It was a long term wish to visit Brighton since I landed London. It never happened in summer time even though planned several times with wife to go there. Last Sunday decided to go Brighton with one of my best friends without any plans. It was a nice trip rather than expected. Following are some snaps taken from Brighton beach.</p>
<p>&nbsp;</p>
<div id="attachment_458" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0174-1.jpg"><img class="size-full wp-image-458" title="Brighton Motorist" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0174-1.jpg" alt="Brighton Motorist" width="500" height="332" /></a><p class="wp-caption-text">Brighton Motorist</p></div>
<div id="attachment_462" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0145-1.jpg"><img class="size-full wp-image-462" title="Seabird" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0145-1.jpg" alt="Seabird" width="500" height="332" /></a><p class="wp-caption-text">Seabird</p></div>
<div id="attachment_461" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0256-1.jpg"><img class="size-full wp-image-461" title="Street light" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0256-1.jpg" alt="Street light" width="500" height="366" /></a><p class="wp-caption-text">Street light</p></div>
<div id="attachment_460" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0183-1.jpg"><img class="size-full wp-image-460" title="Brighton motorist" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0183-1.jpg" alt="Brighton motorist" width="500" height="332" /></a><p class="wp-caption-text">Brighton motorist</p></div>
<div id="attachment_459" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0180-upload-1.jpg"><img class="size-full wp-image-459" title="Brighton motorist" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/11/DSC_0180-upload-1.jpg" alt="Brighton motorist" width="500" height="332" /></a><p class="wp-caption-text">Brighton motorist</p></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/11/01/snaps-from-brighton/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/11/01/snaps-from-brighton/</feedburner:origLink></item>
		<item>
		<title>Generate XML form two dimensional Array</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/iID-HMo4crg/</link>
		<comments>http://www.sarathdr.com/2011/10/07/generate-xml-form-two-dimensional-array/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 14:15:30 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[generate xml]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml from array]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=446</guid>
		<description><![CDATA[I have searched a lot for php code to generate xml from a two dimensional array. But all of them was not working perfectly.  The following code generates xml file from a two dimensional array.  This only works for the array with the following structure.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/10/php-copy.jpg"><img src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/10/php-copy.jpg" alt="" title="php copy" width="550" height="350" class="aligncenter size-full wp-image-450" /></a><br />
I have searched a lot for php code to generate xml from a two dimensional array. But all of them was not working perfectly.  The following code generates xml file from a two dimensional array.  This only works for the array with the following structure.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;share_friend_list&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;;</span>
  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;your_name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Sarath&quot;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;friends&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;friend&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
      <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
        <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
          string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Ryan&quot;</span>
          <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;msisdn&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
          string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;213412414&quot;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
        <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
          string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Nash&quot;</span>
          <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;msisdn&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
          string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;123423421&quot;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
        <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
          string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;Ashish&quot;</span>
          <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;msisdn&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
          string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;123421342&quot;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;your_email&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span>
    string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">19</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;sarath.dr@gmail.com&quot;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$filePath</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xmlFilePath</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">today</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' - '</span><span style="color: #339933;">.</span><span style="color: #000088;">$type</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.xml'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">formatOutput</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$filePath</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
               <span style="color: #000088;">$r</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;data&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$r</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #339933;">@</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$filePath</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$r</span>  <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'data'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$r</span>  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        try
        <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">saveXML</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$filePath</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        catch <span style="color: #009900;">&#40;</span> Exception <span style="color: #000088;">$e</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$b</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$b</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// New parent node</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">is_integer</span><span style="color: #009900;">&#40;</span>  <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span>
                     <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array_slice</span><span style="color: #009900;">&#40;</span>  <span style="color: #000088;">$info</span> <span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span>  <span style="color: #009900;">&#41;</span>
                     <span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parentNode</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parentName</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
               <span style="color: #b1b100;">else</span>
                <span style="color: #009900;">&#123;</span>   <span style="color: #666666; font-style: italic;">// Inner nodes </span>
                    <span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$b</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span>  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
&nbsp;
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parentNode</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parentName</span> <span style="color: #339933;">=</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
                    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$b</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$temp</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createTextNode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span> <span style="color: #990000;">key</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000088;">$b</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$temp</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$newArray</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_slice</span><span style="color: #009900;">&#40;</span>  <span style="color: #000088;">$info</span> <span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$newArray</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$newArray</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span>  <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
               <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$newArray</span><span style="color: #339933;">,</span> <span style="color: #000088;">$b</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Out put XML.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;data<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;share_friend_list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;your_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Sarath<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/your_name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;friends<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Ryan<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;msisdn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>213412414<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/msisdn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Nash<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;msisdn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>123423421<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/msisdn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Ashish<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;msisdn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>123421342<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/msisdn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/friend<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/friends<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;your_email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>sarath.dr@gmail.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/your_email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/share_friend_list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/data<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/10/07/generate-xml-form-two-dimensional-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/10/07/generate-xml-form-two-dimensional-array/</feedburner:origLink></item>
		<item>
		<title>Symfony Doctrine pagination script</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/RdGqPUYTXiQ/</link>
		<comments>http://www.sarathdr.com/2011/09/23/symfony-doctrine-pagination-script/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 13:00:29 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[paginator]]></category>
		<category><![CDATA[php symfony paginator]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony pagination]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=416</guid>
		<description><![CDATA[We usually need database record pagination in symfony with filters. It is very simple and easy to implement in . The below code will be helpful for you to create pagination in Symfony. ]]></description>
			<content:encoded><![CDATA[<div id="attachment_423" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/09/paginator.jpg"><img src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/09/paginator.jpg" alt="Symfony paginator" title="Symfony paginator" width="500" height="306" class="size-full wp-image-423" /></a><p class="wp-caption-text">Symfony paginator</p></div>
<p>We usually need database record pagination in symfony with filters. It is very simple and easy to implement in . The below code will be helpful for you to create pagination in Symfony. </p>
<p>Please add the following code in action.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pager</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfDoctrinePager<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Myclass'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// If you have filers in the to apply in the db query add the following code </span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Myclass a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a.column_name LIKE ?'</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'%'</span><span style="color: #339933;">.</span><span style="color: #000088;">$searchString</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'%'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPage</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequestParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Code to get the query string </span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">queryString</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouting</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCurrentInternalUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It will be useful if you create a helper file to generate the navigation. Please add the following function to the helper file.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> pager_navigation<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pager</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$navigation</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">haveToPaginate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$uri</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\?/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'&amp;'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'?'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'page='</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// First and previous page</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$navigation</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> link_to<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'First'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$navigation</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> link_to<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Previous'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">.</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPreviousPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Pages one by one</span>
    <span style="color: #000088;">$links</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLinks</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$navigation</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> link_to_unless<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">.</span><span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// $navigation .= join('  ', $links);</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Next and last page</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLastPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$navigation</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> link_to<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Next'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">.</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getNextPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$navigation</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> link_to<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Last'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">.</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLastPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$returnHtml</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;ul id='pagination'&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$navigation</span>  <span style="color: #b1b100;">as</span> <span style="color: #000088;">$link</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$returnHtml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;li&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$link</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000088;">$returnHtml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$returnHtml</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p> You can call the above function from the template file. Also add the below code to display records.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pager</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResults</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$record</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
// Show navigation 
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">echo</span> pager_navigation<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$pager</span><span style="color: #339933;">,</span> url_for<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'module/action?'</span><span style="color: #339933;">.</span><span style="color: #990000;">html_entity_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$queryString</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>if you are looking for a quick styling the navigation you can use the following css styling for the pagination navigator links.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&nbsp;
&nbsp;
&nbsp;
<span style="color: #cc00cc;">#pagination</span> li<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span> 
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-indent</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#pagination</span> a<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#9aafe5</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#pagination</span> span <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#2e6ab1</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#pagination</span> <span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#2e6ab1</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FFFFFF</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/09/23/symfony-doctrine-pagination-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/09/23/symfony-doctrine-pagination-script/</feedburner:origLink></item>
		<item>
		<title>The scene which disappeared from Kerala</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/7am2Kt7XEho/</link>
		<comments>http://www.sarathdr.com/2011/09/19/the-scene-which-disappeared-from-kerala/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 19:50:43 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[farming]]></category>
		<category><![CDATA[Karnadaka]]></category>
		<category><![CDATA[Kerala]]></category>
		<category><![CDATA[onam]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=410</guid>
		<description><![CDATA[This shot was taken from Mysore. Hope we can use this images to explain our kid, how the farming was done in ancient days. In kerala Most of our paddy fields are being replaced with concrete buildings.]]></description>
			<content:encoded><![CDATA[<div id="attachment_412" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/09/farming-3.jpg"><img class="size-full wp-image-412" title="Karnataka" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/09/farming-3.jpg" alt="" width="500" height="365" /></a><p class="wp-caption-text">Karnataka</p></div>
<p>This shot was taken from Mysore. Hope we can use this images to explain our kid, how the farming was done in ancient days. In kerala Most of our paddy fields are being replaced with concrete buildings. But we could see something remains in Kuttanadu and Palakkadu. I was very happy after the journey from Mysore, purchased fresh vegetables for Onam in half price and 10 kg of flowers around 1/4 price as compared to the price in Kerala.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/09/19/the-scene-which-disappeared-from-kerala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/09/19/the-scene-which-disappeared-from-kerala/</feedburner:origLink></item>
		<item>
		<title>New Camera – Macro experiments</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/YeexskOkiw8/</link>
		<comments>http://www.sarathdr.com/2011/07/28/new-camera-macro-experiments/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 00:53:33 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Photos]]></category>
		<category><![CDATA[central park]]></category>
		<category><![CDATA[london]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[sarath]]></category>
		<category><![CDATA[sarath photos]]></category>
		<category><![CDATA[sarathdr]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=396</guid>
		<description><![CDATA[After a long gap I have managed to buy a new camera Nikon D 90. Still not familiar with most of the functionality but experimenting with great excitement. I took some macro shots when I get some free time before going to register with GP. All shots are taken between 30 minutes time. Time is the main concern these days.]]></description>
			<content:encoded><![CDATA[<div id="attachment_397" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/07/Macro-21.jpg"><img class="size-full wp-image-397" title="Macro - Photography Sarath D R" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/07/Macro-21.jpg" alt="Macro - Photography Sarath D R" width="500" height="332" /></a><p class="wp-caption-text">Shot from Central park London</p></div>
<p>After a long gap I have managed to buy a new camera Nikon D 90. Still not familiar with most of the functionality but experimenting with great excitement. I took some macro shots when I get some free time before going to register with GP. All shots are taken between 30 minutes time. Time is the main concern these days.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/07/28/new-camera-macro-experiments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/07/28/new-camera-macro-experiments/</feedburner:origLink></item>
		<item>
		<title>Get Symfony web root Url without Script name</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/DJE1Kw_vzM4/</link>
		<comments>http://www.sarathdr.com/2011/07/22/get-symfony-web-root-url-without-script-name/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 14:16:48 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[no script name]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony root url]]></category>
		<category><![CDATA[web root url]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/2011/07/22/get-symfony-web-root-url-without-script-name/</guid>
		<description><![CDATA[I had a requirement to access an image inside a folder in the web root folder in symfony. I came across a solution but I am not sure this is the only way to get the url to path. Please add a comment if you have any other solution.]]></description>
			<content:encoded><![CDATA[<p><br class="clear" /></p>
<p>I had a requirement to access an image inside a folder in the web root folder in symfony. I came across a solution but I am not sure this is the only way to get the url to path. Please add a comment if you have any other solution.</p>
<p>For example, Let your path to the web folder be &#8220;project/trunk/web&#8221;. The following code will output  &#8221;project/trunk/web&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">sfContext<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRelativeUrlRoot</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<pre>You will get the base url by</pre>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">sfContext<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUriPrefix</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>You can concatenate both string to get the result.</p>
<p>http:://localhost/project/trunk/web</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/07/22/get-symfony-web-root-url-without-script-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/07/22/get-symfony-web-root-url-without-script-name/</feedburner:origLink></item>
		<item>
		<title>Install Symfony Plugins manually</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/z2ZPRnZb4oE/</link>
		<comments>http://www.sarathdr.com/2011/07/17/install-symfony-plugins-manually/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 00:58:02 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[install symfony plugins manually]]></category>
		<category><![CDATA[symfony excel plugin]]></category>
		<category><![CDATA[symfony plugins]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=370</guid>
		<description><![CDATA[There was some  problem occurred to my PEAR installation in my laptop so I was unable to install symfony plugins. At last I solved the issue by manually installing the plugin. Following steps are involved in the manual installation of the symfony plugin.]]></description>
			<content:encoded><![CDATA[<p><br class="clear" /><br />
There was some  problem occurred to my PEAR installation in my laptop so I was unable to install symfony plugins. At last I solved the issue by manually installing the plugin. Following steps are involved in the manual installation of the symfony plugin. Consider installing symfony XLS reader Plugin.</p>
<ul>
<li>Download the plugin from <a title="PHP Excel plugin" href="http://www.symfony-project.org/plugins/sfPhpExcelPlugin">here</a></li>
<li>Unzip the files and copy the folder to <strong>plugins/</strong> folder with folder name <strong>sfPhpExcelPlugin</strong></li>
<li>Edit the  configuration file <strong>config/ProjectConfiguration.class.php</strong>see below example

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enablePlugins</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sfDoctrinePlugin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sfPhpExcelPlugin'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>Finally run the following command

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">php symfony plugin<span style="color: #339933;">:</span>publish<span style="color: #339933;">-</span>assets</pre></div></div>

</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/07/17/install-symfony-plugins-manually/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/07/17/install-symfony-plugins-manually/</feedburner:origLink></item>
		<item>
		<title>Symfony Doctrine – Useful commands</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/ghPhP_4JPYc/</link>
		<comments>http://www.sarathdr.com/2011/07/09/symfony-doctrine-useful-commands/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 00:01:35 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[doctrine commandsi]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony commands]]></category>
		<category><![CDATA[symfony doctrine]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=356</guid>
		<description><![CDATA[I always forget the Symfony doctrine commands. This post will be useful for you remember them as well. I can also refer it :). This is not the complete list, but I will add it eventually. 
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/07/Symfony-Commands.png"><img class="size-full wp-image-374 aligncenter" title="Symfony-Commands" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2011/07/Symfony-Commands.png" alt="Symfony Commands" width="453" height="306" /></a></p>
<p>I always forget the Symfony doctrine commands. This post will be useful for you remember them as well. I can also refer it <img src='http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=.sarathdr.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . This is not the complete list, but I will add it eventually.</p>
<p>Creates Application:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> $ php symfony generate:app &lt;app_name&gt;</pre></div></div>

<p>Create Module:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> $ php symfony generate:module &lt;app_name&gt; &lt;module_name&gt;</pre></div></div>

<p>Creates database for current model</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> $ php symfony doctrine<span style="color: #339933;">:</span>build<span style="color: #339933;">-</span>db</pre></div></div>

<p>Creates classes for current model</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> $ php symfony doctrine<span style="color: #339933;">:</span>build<span style="color: #339933;">-</span>model</pre></div></div>

<p>Creates schema.yml from current database</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> $ php symfony doctrine<span style="color: #339933;">:</span>build<span style="color: #339933;">-</span>schema</pre></div></div>

<p>Creates sql for the current model</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> $ php symfony doctrine<span style="color: #339933;">:</span>build<span style="color: #339933;">-</span>sql</pre></div></div>

<p>Inserts sql for the current model</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> $ php symfony doctrine<span style="color: #339933;">:</span>insert<span style="color: #339933;">-</span>sql</pre></div></div>

<p>Symfony project deploy dry run</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> $ php symfony project:deploy &lt;environment&gt; -t</pre></div></div>

<p>Symfony deploy project</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> $ php symfony project:deploy &lt;environment&gt; -t --go</pre></div></div>

<p>Generates language files</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> $ php symfony i18n:extract --auto-save &lt;app_name&gt; &lt;culture&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2011/07/09/symfony-doctrine-useful-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2011/07/09/symfony-doctrine-useful-commands/</feedburner:origLink></item>
		<item>
		<title>Doctrine Query to find out rank of a column value</title>
		<link>http://feedproxy.google.com/~r/sarathdr/~3/O23PLBkdnrg/</link>
		<comments>http://www.sarathdr.com/2010/12/30/doctrine-query-to-find-out-rank-of-a-column-value/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 19:13:20 +0000</pubDate>
		<dc:creator>Sarath D R</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[doctrine query]]></category>
		<category><![CDATA[rank of a column value]]></category>
		<category><![CDATA[sql query]]></category>
		<category><![CDATA[sql query to find rank]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[symfony doctrine query]]></category>

		<guid isPermaLink="false">http://www.sarathdr.com/?p=348</guid>
		<description><![CDATA[Following is an easy symfony doctrine query to find out rank of a particular column value in a table. Suppose if you need to find out the rank of a user with the reference to the column 'marks', use the following query.]]></description>
			<content:encoded><![CDATA[<div id="attachment_347" class="wp-caption aligncenter" style="width: 544px"><a href="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2010/12/Symfony-doctrine-query-to-f1.png"><img class="size-full wp-image-347" title="Symfony-doctrine-query-to-find-out-rank-of-a-column-value" src="http://www.sarathdr.com/wp-content/plugins/php-image-cache/image.php?path=/uploads/2010/12/Symfony-doctrine-query-to-f1.png" alt="Symfony doctrine query to find out rank of a column value" width="534" height="263" /></a><p class="wp-caption-text">Symfony doctrine query to find out rank of a column value</p></div>
<p>Following is an easy symfony doctrine query to find out rank of a particular column value in a table. Suppose if you need to find out the rank of a user with the reference to the column &#8216;marks&#8217;, use the following query.</p>
<p>&#8216;Stats&#8217; is the name of the table</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> Doctrine_Query<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'((SELECT COUNT(1) AS num FROM stats  WHERE stats.marks  &gt; s.marks ) + 1)  AS rank'</span><span style="color: #009900;">&#41;</span>
                           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Stats s'</span><span style="color: #009900;">&#41;</span>
                           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'s.user_id = ?'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">&#41;</span>
                           <span style="color: #339933;">-&gt;</span><span style="color: #004000;">orderBy</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rank'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
             <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetchOne</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sarathdr.com/2010/12/30/doctrine-query-to-find-out-rank-of-a-column-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.sarathdr.com/2010/12/30/doctrine-query-to-find-out-rank-of-a-column-value/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (enhanced)

Served from: www.sarathdr.com @ 2012-02-10 23:47:52 -->

