<?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: Pagination with custom find types in CakePHP</title>
	<atom:link href="http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/</link>
	<description>A glimpse at a coder&#039;s troubled mind</description>
	<lastBuildDate>Wed, 30 Jun 2010 11:12:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Pagination with custom find types in CakePHP &#124; Coding My Thoughts &#124; Source code bank</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-1485</link>
		<dc:creator>Pagination with custom find types in CakePHP &#124; Coding My Thoughts &#124; Source code bank</dc:creator>
		<pubDate>Fri, 30 Apr 2010 00:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-1485</guid>
		<description>[...] the original post: Pagination with custom find types in CakePHP &#124; Coding My Thoughts       If you enjoyed this article please consider sharing [...]</description>
		<content:encoded><![CDATA[<p>[...] the original post: Pagination with custom find types in CakePHP | Coding My Thoughts       If you enjoyed this article please consider sharing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adnan</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-440</link>
		<dc:creator>adnan</dc:creator>
		<pubDate>Mon, 25 Jan 2010 11:03:23 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-440</guid>
		<description>@ohcibi, calling the $paginator-&gt;options(array(‘url’ =&gt; $this-&gt;passedArgs)); in the view is never a good idea, though it&#039;s suggested in the Cake Book. Never call it.

I have found a better way for advance pagination with custom/derived fields in a simple and easy method.

Here is the details in the blog post: http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/

Hope you&#039;ll find it helpful.

Thanks</description>
		<content:encoded><![CDATA[<p>@ohcibi, calling the $paginator-&gt;options(array(‘url’ =&gt; $this-&gt;passedArgs)); in the view is never a good idea, though it&#8217;s suggested in the Cake Book. Never call it.</p>
<p>I have found a better way for advance pagination with custom/derived fields in a simple and easy method.</p>
<p>Here is the details in the blog post: <a href="http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/" rel="nofollow">http://abcoder.com/php/cakephp/cakephp-advanced-pagination-sort-by-derived-field/</a></p>
<p>Hope you&#8217;ll find it helpful.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mariano.iglesias [Member]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-8</link>
		<dc:creator>mariano.iglesias [Member]</dc:creator>
		<pubDate>Sun, 27 Dec 2009 07:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-8</guid>
		<description>@Giuliano: You are wrong. You CAN do that. Try it.
</description>
		<content:encoded><![CDATA[<p>@Giuliano: You are wrong. You CAN do that. Try it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giuliano [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-7</link>
		<dc:creator>Giuliano [Visitor]</dc:creator>
		<pubDate>Sat, 26 Dec 2009 11:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-7</guid>
		<description>This isn&#039;t a very good method. It&#039;s clean but doesn&#039;t allow you to pass a variable to your paginate conditions, such as:&lt;br /&gt;
&lt;br /&gt;
$posts = $this-&gt;Post-&gt;find(&#039;all&#039;, array(&lt;br /&gt;
&#039;conditions&#039; =&gt; &lt;br /&gt;
array(&#039;Post.category&#039; =&gt; $id),&lt;br /&gt;
array(&#039;Post.published&#039; =&gt; 1),&lt;br /&gt;
&#039;order&#039; =&gt; array(&#039;Post.created&#039; =&gt; &#039;desc&#039;)&lt;br /&gt;
));&lt;br /&gt;
&lt;br /&gt;
would not work with this method
</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t a very good method. It&#8217;s clean but doesn&#8217;t allow you to pass a variable to your paginate conditions, such as:</p>
<p>$posts = $this->Post->find(&#8216;all&#8217;, array(<br />
&#8216;conditions&#8217; => <br />
array(&#8216;Post.category&#8217; => $id),<br />
array(&#8216;Post.published&#8217; => 1),<br />
&#8216;order&#8217; => array(&#8216;Post.created&#8217; => &#8216;desc&#8217;)<br />
));</p>
<p>would not work with this method</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo Jorge [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-6</link>
		<dc:creator>Leonardo Jorge [Visitor]</dc:creator>
		<pubDate>Mon, 19 Oct 2009 08:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-6</guid>
		<description>This implematation looks like Named Scope Behavior&lt;br /&gt;
&lt;br /&gt;
http://github.com/joelmoss/cakephp-namedscope
</description>
		<content:encoded><![CDATA[<p>This implematation looks like Named Scope Behavior</p>
<p><a href="http://github.com/joelmoss/cakephp-namedscope" rel="nofollow">http://github.com/joelmoss/cakephp-namedscope</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jes&#250;s &#193;ngel [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-5</link>
		<dc:creator>Jes&#250;s &#193;ngel [Visitor]</dc:creator>
		<pubDate>Thu, 08 Oct 2009 17:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-5</guid>
		<description>Be careful.&lt;br /&gt;
&lt;br /&gt;
Original find method has four args, but this one only has two.&lt;br /&gt;
&lt;br /&gt;
You have to add the order and recursive params or you will loose them
</description>
		<content:encoded><![CDATA[<p>Be careful.</p>
<p>Original find method has four args, but this one only has two.</p>
<p>You have to add the order and recursive params or you will loose them</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jes&#250;s &#193;ngel [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-4</link>
		<dc:creator>Jes&#250;s &#193;ngel [Visitor]</dc:creator>
		<pubDate>Thu, 08 Oct 2009 17:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-4</guid>
		<description>&#161;Be careful!&lt;br /&gt;
&lt;br /&gt;
Model-&gt;find() has four args:&lt;br /&gt;
&lt;br /&gt;
$type, $options = array(), $order = null, $recursive = null&lt;br /&gt;
&lt;br /&gt;
But the example&#039;s find method only has two args, so you loose the other ones.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Change:&lt;br /&gt;
public function find($type, $options = array(), $order = null, $recursive = null)&lt;br /&gt;
&lt;br /&gt;
return parent::find($type, $options, $order = null, $recursive = null);&lt;br /&gt;
</description>
		<content:encoded><![CDATA[<p>&#161;Be careful!</p>
<p>Model->find() has four args:</p>
<p>$type, $options = array(), $order = null, $recursive = null</p>
<p>But the example&#8217;s find method only has two args, so you loose the other ones.</p>
<p>
Change:<br />
public function find($type, $options = array(), $order = null, $recursive = null)</p>
<p>return parent::find($type, $options, $order = null, $recursive = null);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pedro [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-3</link>
		<dc:creator>Pedro [Visitor]</dc:creator>
		<pubDate>Tue, 25 Aug 2009 09:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-3</guid>
		<description>alguna idea mariano...?!
</description>
		<content:encoded><![CDATA[<p>alguna idea mariano&#8230;?!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pedro [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-2</link>
		<dc:creator>Pedro [Visitor]</dc:creator>
		<pubDate>Fri, 21 Aug 2009 06:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-2</guid>
		<description>hola mariano!&lt;br /&gt;
&lt;br /&gt;
Took about a week looking for information on how to customize the URL from the paginate method. &lt;br /&gt;
&lt;br /&gt;
I found several things but nothing really useful, and the truth that I am a little off and I saw that you work with CakePHP. &lt;br /&gt;
The issue is that I have to keep the urls of my site just because they are indexed in Google and the SEO and the structure of URLs is very well composed. For example, I have a url like http:miproyecto.loc/padres which I included in a routes.php enroute to do the following: &lt;br /&gt;
&lt;br /&gt;
Router::connect (&#039;/padres&#039;, array(&#039;controller&#039;=&gt;&#039;contenidos&#039;, &#039;action&#039;=&gt;&#039;listado&#039;,&#039;parameters&#039;=&gt;&#039;listar_todo&#039;));&lt;br /&gt;
&lt;br /&gt;
and when to call the method paginate: &lt;br /&gt;
&lt;br /&gt;
$array_contenidos = $this-&gt;paginate(&#039;Contenido&#039;,$criterios);&lt;br /&gt;
&lt;br /&gt;
the url that the paginate method looks like: &lt;br /&gt;
&lt;br /&gt;
http://miproyecto.loc/contenidos/listado/page:2 &lt;br /&gt;
but I want to get &lt;br /&gt;
http:miproyecto.loc/padres-2. &lt;br /&gt;
&lt;br /&gt;
I tried everything and I managed to change the urls generated by the method of pagination In the function link of the helper paginator.php I have included the following lines &lt;br /&gt;
&lt;br /&gt;
/* APA&#209;O PARA PAGINACION */&lt;br /&gt;
$seccion_url = explode(&quot;-&quot;,$this-&gt;params[&#039;url&#039;][&#039;url&#039;]);&lt;br /&gt;
$url = &#039;http://&#039;.DOMINIO.&#039;/&#039;.$seccion_url[0].&#039;-&#039;.$url[&#039;page&#039;];&lt;br /&gt;
/* FIN APA&#209;O PARA PAGINACION */&lt;br /&gt;
return $this-&gt;{$obj}-&gt;link($title, $url, $options);&lt;br /&gt;
&lt;br /&gt;
But now I have the problem to put in all the rules (manually) routes.php (which I can die because there are thousands) &lt;br /&gt;
Router:: connect ( &#039;/ preconception-2&#039;, array ( &#039;controller&#039; =&gt; &#039;content&#039;, &#039;action&#039; =&gt; &#039;list&#039;, &#039;parameters&#039; =&gt;&#039; listar_todo &#039;,&#039; named &#039;=&gt; array (&#039; page &#039;=&gt; 2)));&lt;br /&gt;
&lt;br /&gt;
I hope you can help me and give some advice or instructions.&lt;br /&gt;
&lt;br /&gt;
Thx&lt;br /&gt;
&lt;br /&gt;
Muchas gracias y saludos desde Espa&#241;a!&lt;br /&gt;
&lt;br /&gt;
</description>
		<content:encoded><![CDATA[<p>hola mariano!</p>
<p>Took about a week looking for information on how to customize the URL from the paginate method. </p>
<p>I found several things but nothing really useful, and the truth that I am a little off and I saw that you work with CakePHP. <br />
The issue is that I have to keep the urls of my site just because they are indexed in Google and the SEO and the structure of URLs is very well composed. For example, I have a url like http:miproyecto.loc/padres which I included in a routes.php enroute to do the following: </p>
<p>Router::connect (&#8216;/padres&#8217;, array(&#8216;controller&#8217;=>&#8217;contenidos&#8217;, &#8216;action&#8217;=>&#8217;listado&#8217;,'parameters&#8217;=>&#8217;listar_todo&#8217;));</p>
<p>and when to call the method paginate: </p>
<p>$array_contenidos = $this->paginate(&#8216;Contenido&#8217;,$criterios);</p>
<p>the url that the paginate method looks like: </p>
<p><a href="http://miproyecto.loc/contenidos/listado/page:2" rel="nofollow">http://miproyecto.loc/contenidos/listado/page:2</a> <br />
but I want to get <br />
http:miproyecto.loc/padres-2. </p>
<p>I tried everything and I managed to change the urls generated by the method of pagination In the function link of the helper paginator.php I have included the following lines </p>
<p>/* APA&#209;O PARA PAGINACION */<br />
$seccion_url = explode(&#8220;-&#8221;,$this->params['url']['url']);<br />
$url = &#8216;http://&#8217;.DOMINIO.&#8217;/&#8217;.$seccion_url[0].&#8217;-&#8217;.$url['page'];<br />
/* FIN APA&#209;O PARA PAGINACION */<br />
return $this->{$obj}->link($title, $url, $options);</p>
<p>But now I have the problem to put in all the rules (manually) routes.php (which I can die because there are thousands) <br />
Router:: connect ( &#8216;/ preconception-2&#8242;, array ( &#8216;controller&#8217; => &#8216;content&#8217;, &#8216;action&#8217; => &#8216;list&#8217;, &#8216;parameters&#8217; =>&#8217; listar_todo &#8216;,&#8217; named &#8216;=> array (&#8216; page &#8216;=> 2)));</p>
<p>I hope you can help me and give some advice or instructions.</p>
<p>Thx</p>
<p>Muchas gracias y saludos desde Espa&#241;a!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ohcibi [Visitor]</title>
		<link>http://marianoiglesias.com.ar/cakephp/pagination-with-custom-find-types-in-cakephp/comment-page-1/#comment-1</link>
		<dc:creator>ohcibi [Visitor]</dc:creator>
		<pubDate>Mon, 13 Jul 2009 08:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://marianoiglesias.com.ar/1/pagination-with-custom-find-types-in-cakephp/#comment-1</guid>
		<description>The urls, which are generated by the paginatorhelper are not e.g. controller/action/page:3 but controller/action/name_of_find_type/page:3. &lt;br /&gt;
&lt;br /&gt;
If $paginator-&gt;options(array(&#039;url&#039; =&gt; $this-&gt;passedArgs)); is called in the view then after every click on a paginator helper link theres one name_of_find_type more in the url.
</description>
		<content:encoded><![CDATA[<p>The urls, which are generated by the paginatorhelper are not e.g. controller/action/page:3 but controller/action/name_of_find_type/page:3. </p>
<p>If $paginator->options(array(&#8216;url&#8217; => $this->passedArgs)); is called in the view then after every click on a paginator helper link theres one name_of_find_type more in the url.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk
Database Caching 11/30 queries in 0.099 seconds using disk

Served from: marianoiglesias.com.ar @ 2010-07-30 05:25:00 -->