How to pass pagination options with cakephp advanced options?

I have a list of categories that displays a list of items below it.

In this way:

routes:

Router::connect('/category/:slug', array('controller' => 'Product', 'action'=>'catview', 'slug'=> '[0-9a-zA-Z]+')); Router::connect('/category/:slug/:page', array('controller' => 'Product', 'action'=>'catview','slug'=> '[0-9a-zA-Z]+','page'=>'[0-9]+')); 

and

when I do this on the results page, it just doesn't work:

 <?php $slug = $this->params['slug']; $this->Paginator->options(array('url'=> array('controller' => 'Product', 'action'=>'catview','slug'=> $slug))); echo $this->Paginator->prev('<< Show me previous', array('class'=>'prev')) . $this->Paginator->next('Show me more >>', array('class'=>'next')); ?> 

It does not change the results; it shows the same result as on page 1.

Any ideas I'm wrong about?

+4
source share
1 answer

Thanks to AD7six for reference.

My controller should have:

 $this->paginate = array( //other stuff here 'paramType' => 'querystring' ); 

The following are:

 $this->Paginator->options(array('url'=> array('controller' => 'Product', 'action'=>'catview','slug'=> $slug), 'convertKeys' => array('page'))); 

in the view file

+6
source

Source: https://habr.com/ru/post/1493938/


All Articles