<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Thinking about the pagination feature</title>
	<atom:link href="http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 16 Mar 2010 17:17:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Fabricio Sodano</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-123269</link>
		<dc:creator>Fabricio Sodano</dc:creator>
		<pubDate>Tue, 17 Mar 2009 15:48:28 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-123269</guid>
		<description>All right! I&#039;ll try that.

Thanks a lot!</description>
		<content:encoded><![CDATA[<p>All right! I&#8217;ll try that.</p>
<p>Thanks a lot!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-123268</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 17 Mar 2009 15:47:07 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-123268</guid>
		<description>@Fabricio: Thanks for your comment!

The only solution I see at the moment is to copy the paginate() method from the Controller class and to add this method to your own controller. Then you can apply your change there.

And regarding side effects, you could run the test case for the Controller class, and see whether it will fail ;-)

Hope that helps!</description>
		<content:encoded><![CDATA[<p>@Fabricio: Thanks for your comment!</p>
<p>The only solution I see at the moment is to copy the paginate() method from the Controller class and to add this method to your own controller. Then you can apply your change there.</p>
<p>And regarding side effects, you could run the test case for the Controller class, and see whether it will fail ;-)</p>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabricio Sodano</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-123208</link>
		<dc:creator>Fabricio Sodano</dc:creator>
		<pubDate>Mon, 16 Mar 2009 17:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-123208</guid>
		<description>Hello...

This is an old topic, I know... but as today there was no way to fix this (The DISCTINCT not being applied to the count) however, i&#039;ve found that in the controller.php file, the paginate method has this line to fetch the count for the pagination:

			$count = $object-&gt;find(&#039;count&#039;, array_merge($parameters, $extra));

However, when you go and look into the paginate method, the 2nd param is the &quot;fields&quot; array, so... I&#039;ve changed the previous line to:

			$count = $object-&gt;find(&#039;count&#039;, $fields);

And now it works fully. However, I&#039;m pretty sure it will have side effects, but I haven&#039;t seen any yet :)

My question is: Is there another way to implement this solution *specifically* for this particular case instead of the full app?


Cheers &amp; Thanks!</description>
		<content:encoded><![CDATA[<p>Hello&#8230;</p>
<p>This is an old topic, I know&#8230; but as today there was no way to fix this (The DISCTINCT not being applied to the count) however, i&#8217;ve found that in the controller.php file, the paginate method has this line to fetch the count for the pagination:</p>
<p>			$count = $object-&gt;find(&#8216;count&#8217;, array_merge($parameters, $extra));</p>
<p>However, when you go and look into the paginate method, the 2nd param is the &#8220;fields&#8221; array, so&#8230; I&#8217;ve changed the previous line to:</p>
<p>			$count = $object-&gt;find(&#8216;count&#8217;, $fields);</p>
<p>And now it works fully. However, I&#8217;m pretty sure it will have side effects, but I haven&#8217;t seen any yet :)</p>
<p>My question is: Is there another way to implement this solution *specifically* for this particular case instead of the full app?</p>
<p>Cheers &amp; Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pixelastic</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-103626</link>
		<dc:creator>Pixelastic</dc:creator>
		<pubDate>Tue, 19 Aug 2008 15:09:47 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-103626</guid>
		<description>Hmm, you&#039;re right, maybe I should limit myself only to the model(s) who actually need it.</description>
		<content:encoded><![CDATA[<p>Hmm, you&#8217;re right, maybe I should limit myself only to the model(s) who actually need it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-103579</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Tue, 19 Aug 2008 06:10:17 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-103579</guid>
		<description>@Pixelastic: Do you know &lt;a href=&quot;http://en.wikipedia.org/wiki/You_Ain&#039;t_Gonna_Need_It&quot; rel=&quot;nofollow&quot;&gt;YAGNI&lt;/a&gt;? ;-)</description>
		<content:encoded><![CDATA[<p>@Pixelastic: Do you know <a href="http://en.wikipedia.org/wiki/You_Ain't_Gonna_Need_It" rel="nofollow">YAGNI</a>? ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pixelastic</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-103530</link>
		<dc:creator>Pixelastic</dc:creator>
		<pubDate>Mon, 18 Aug 2008 16:17:42 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-103530</guid>
		<description>I could have limited myself to adding paginate and paginateCount to the only model that actually needed such a treatment, but I think multiple custom pagination could be useful in the future for other models.</description>
		<content:encoded><![CDATA[<p>I could have limited myself to adding paginate and paginateCount to the only model that actually needed such a treatment, but I think multiple custom pagination could be useful in the future for other models.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-103528</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 18 Aug 2008 16:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-103528</guid>
		<description>@Pixelastic: I&#039;m glad you found a solution. Personally, I wouldn&#039;t add paginate() and paginateCount() to the AppModel if it is not really necessary, but else your approach looks fine.</description>
		<content:encoded><![CDATA[<p>@Pixelastic: I&#8217;m glad you found a solution. Personally, I wouldn&#8217;t add paginate() and paginateCount() to the AppModel if it is not really necessary, but else your approach looks fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pixelastic</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-103499</link>
		<dc:creator>Pixelastic</dc:creator>
		<pubDate>Mon, 18 Aug 2008 08:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-103499</guid>
		<description>@myself : I have found a way, I just have to : 

1/ create a Model::paginateIndex and Model::paginateCountIndex methods for paginating my index page. (and multiple other methods for each special pagination I will need)

2/ Overriding the AppModel::paginate and AppModel::paginateCount methods with my own, checking for the $conditions params and if a string (eg. &#039;index&#039;) returning the corresponding method in the model ( $paginateFunction = $paginate&quot;.Inflector::camelize($conditions); ) and returning $this-&gt;{$paginateFunction}([...]);
(same goes for paginateCount)

3/ Calling my paginate action in my controller like 
$this-&gt;paginate = array(&#039;conditions&#039; =&gt; &#039;index&#039;);
$itemList = $this-&gt;paginate();</description>
		<content:encoded><![CDATA[<p>@myself : I have found a way, I just have to : </p>
<p>1/ create a Model::paginateIndex and Model::paginateCountIndex methods for paginating my index page. (and multiple other methods for each special pagination I will need)</p>
<p>2/ Overriding the AppModel::paginate and AppModel::paginateCount methods with my own, checking for the $conditions params and if a string (eg. &#8216;index&#8217;) returning the corresponding method in the model ( $paginateFunction = $paginate&#8221;.Inflector::camelize($conditions); ) and returning $this-&gt;{$paginateFunction}([...]);<br />
(same goes for paginateCount)</p>
<p>3/ Calling my paginate action in my controller like<br />
$this-&gt;paginate = array(&#8216;conditions&#8217; =&gt; &#8216;index&#8217;);<br />
$itemList = $this-&gt;paginate();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pixelastic</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-103458</link>
		<dc:creator>Pixelastic</dc:creator>
		<pubDate>Sun, 17 Aug 2008 23:35:44 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-103458</guid>
		<description>As noted before, first comment : &quot;Also, your point about the paginate/paginateCount methods is pretty much moot, since you can define as many alternative types of finders for the find() method as you want, and/or pass in custom flags in the options array.&quot;

Can please somebody expand on that ? I&#039;m stuck on how to define different pagination rules for one same controller.
I need a special paginate for the admin panel and another for the public page (the latter is quite complicated and needs a very special treatment), but I would like to find a more generic way to define multiple pagination rules for the same controller.</description>
		<content:encoded><![CDATA[<p>As noted before, first comment : &#8220;Also, your point about the paginate/paginateCount methods is pretty much moot, since you can define as many alternative types of finders for the find() method as you want, and/or pass in custom flags in the options array.&#8221;</p>
<p>Can please somebody expand on that ? I&#8217;m stuck on how to define different pagination rules for one same controller.<br />
I need a special paginate for the admin panel and another for the public page (the latter is quite complicated and needs a very special treatment), but I would like to find a more generic way to define multiple pagination rules for the same controller.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/06/29/thinking-about-the-pagination-feature/comment-page-1/#comment-101273</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 31 Jul 2008 15:36:37 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=618#comment-101273</guid>
		<description>@rick: You could implement paginate() and paginateCount() in your model for this purpose. But I&#039;m not sure whether this is the best solution, maybe someone in the CakePHP Google Group has a better idea.

Hope that helps!</description>
		<content:encoded><![CDATA[<p>@rick: You could implement paginate() and paginateCount() in your model for this purpose. But I&#8217;m not sure whether this is the best solution, maybe someone in the CakePHP Google Group has a better idea.</p>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
