<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Page comments</title>
		<link>http://www.ssbits.com/home/</link>
		<atom:link href="http://www.ssbits.com/home/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_2420</link>
			<description>I updated this to work with the new DataList in Silverstripe 3. Any improvements welcome:

		public function PrevNextPage($Mode = 'next') {
		
		
			if($Mode == 'next'){
				$Direction = &quot;Sort:GreaterThan&quot;;
				$Sort = &quot;Sort ASC&quot;;
				}
			elseif($Mode == 'prev'){
				$Direction = &quot;Sort:LessThan&quot;;
				$Sort = &quot;Sort DESC&quot;;
			}
			else{
				return false;
			}
			
			$PrevNext = SiteTree::get()	  	
			    -&gt;filter(array(
			        'ParentID' =&gt; $this-&gt;ParentID,
			        $Direction =&gt; $this-&gt;Sort
			    ))
				-&gt;sort($Sort)				
				-&gt;First()
			;
			
			if ($PrevNext) return $PrevNext;
		}	</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_2420</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_1847</link>
			<description>Great article, was very usefull.

Just for those copy pasting, the last snippet:
&lt;p&gt;Page $CurrentPage of $NoOfSiblings&lt;/p&gt;

should be:
&lt;p&gt;Page $CurrentPageNumber of $NumberOfSiblings&lt;/p&gt;</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_1847</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_1234</link>
			<description>Sorry, let me edit that... As soon as I hit 'Post' I realized that I had not tried using $Parent.Link inside the &lt;% if .... %&gt; but before the &lt;% else %&gt; tag.  Sure enough, it works inside the control as long as it's not after the 'else' tag.  Of course, that still doesn't help me because I am still unable to do what I need to...  So confused!</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_1234</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_1233</link>
			<description>Thanks, I was really hoping to find something like this!  Only problem for me is that, in applying Prawnstar's suggestion and adding in an &lt;% else %&gt; tag, I CANNOT use $Parent.Link.  I have tried putting plain text after then 'else' tag, and that works fine (which is what I have right now).  I also tried creating a link using $Parent.Link in a different spot on the page (so, not inside this &lt;% control ... %&gt;) and that works fine.  But no matter what I try, I cannot create a Parent link inside the control!!!  Please help... I have searched for a solution and I cannot find one.</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_1233</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_547</link>
			<description>Hi, Aram,

I followed your tutorial here and have noted that when PrevNextPage() returns false (i.e., no more previous or next records) the link is still printed in the template.ss because it lacks an 'if' statement. Even though the function is returning false, the link gets printed. For me the link takes me to the home page.

Something like this solved my issue (could use an else statement):
&lt;% if Link %&gt;
    &lt;a href=&quot;http://www.ssbits.com/&quot; title=&quot;Go to $Title&quot;&gt;previous page&lt;/a&gt;
&lt;% end_if %&gt;</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_547</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_99</link>
			<description>Hi Bazilio, it seems to work ok for me?

function test(){ 
$CommentTest = $this-&gt;MyComment()-&gt;Test; 
%f = % 5;
}</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_99</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_96</link>
			<description>cant post any code to comment, if fails (% or $)</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2009/creating-previous-and-next-buttons-on-a-page/#PageComment_96</guid>
		</item>
		

	</channel>
</rss>