Thursday, March 1, 2012

Re: CakePHP 2.1 pagination routing (Help)

I just ran into this with 2.x. The problem is that the page number is
looked for in CakeRequest's 'named' params.

I fixed it by putting this in AppController::beforeFilter():

if (isset($this->request->params['page']))
{
$this->request->params['named']['page'] = $this->request->params['page'];
}

You might want to change your route to specifically check for an
integer for 'page' in the third array:

Router::connect('/satovi/:page',
array('controller'=>'products','action'=>'index'), ('page' =>
'[0-9]+'));


On Thu, Mar 1, 2012 at 3:26 PM, Salines <nikola.paradzik@gmail.com> wrote:
> Hello, i need small help
>
>
> my cakephp 1.3.x site has correct url,  like
>
> first page :         http://detas.ba/satovi
> second page :    http://detas.ba/satovi/2
> ...
> with this routing codes
>
> Router::connect('/satovi/:page',
> array('controller'=>'products','action'=>'index'));
>
> after upgrading on the cakephp 2.1 this not working. Whats its wrong?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: