Note that there are some explanatory texts on larger screens.

plurals
  1. POPagination + Routes problem in CakePHP 1.3.6
    primarykey
    data
    text
    <p>I can't paginate my results if I access them from a Routed url. These are the routes that I'm using:</p> <pre><code>// NEWS Router::connect('/news.rss', array('controller' =&gt; 'posts', 'action' =&gt; 'index', 'ext' =&gt; 'rss')); Router::connect('/news/*', array('controller' =&gt; 'posts', 'action' =&gt; 'index')); Router::connect('/:lang/posts/*', array('controller' =&gt; 'posts', 'action' =&gt; 'index')); </code></pre> <p>I know that in the last route I'm not passing the :lang parameter, but if I pass it:</p> <pre><code>Router::connect('/:lang/news/*', array('controller' =&gt; 'posts', 'action' =&gt; 'index'), array('lang' =&gt; $regex['lang'], 'pass' =&gt; array('lang'))); </code></pre> <p>It does not work either.</p> <p>If I try to access the url /news/page:2 it will show me the results from the first page. I printed out $this->params to see if it takes the page number correctly, and, in first instance, it does:</p> <pre><code>Array ( [lang] =&gt; ca [named] =&gt; Array ( [page] =&gt; 2 ) [pass] =&gt; Array ( ) [controller] =&gt; posts [action] =&gt; index [plugin] =&gt; [url] =&gt; Array ( [ext] =&gt; html [url] =&gt; ca/posts/page:2 ) [form] =&gt; Array ( ) [...] ) </code></pre> <p>This part of the array (I've ommited some parts that I'll show you later) is the same if I access /news/page:2 and /posts/index/page:2, but if you take a look to this part:</p> <pre><code>Array ( [...] [paging] =&gt; Array ( [Post] =&gt; Array ( [page] =&gt; 1 [current] =&gt; 3 [count] =&gt; 3 [prevPage] =&gt; [nextPage] =&gt; [pageCount] =&gt; 1 [defaults] =&gt; Array ( [limit] =&gt; 3 [step] =&gt; 1 [order] =&gt; Post.created DESC [conditions] =&gt; Array ( [Post.active] =&gt; 1 [Post.page] =&gt; [0] =&gt; Post.public_date &lt;= NOW() ) ) [options] =&gt; Array ( [page] =&gt; 1 [limit] =&gt; 3 [order] =&gt; Post.created DESC [conditions] =&gt; Array ( [Post.active] =&gt; 1 [Post.page] =&gt; [0] =&gt; Post.public_date &lt;= NOW() ) ) ) ) </code></pre> <p>You can see that it doesn't take the page number correctly. But if I access from /posts/index/page:2 it takes the number well and pagination works.</p> <p>If only it were pretty URLs do not bother me, but considering that the site is multilingual, I need at least that works if I access /en/posts/index/page:2 (or /en/news/page:2)...</p> <p>Here is my full routes.php file:</p> <p><a href="http://pastebin.com/th4hLZNz" rel="nofollow">http://pastebin.com/th4hLZNz</a></p> <p>Anybody has an idea of what is occurring?</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload