如何传递带有附加参数的分页参数



我有一个类别列表,它显示了下面的项目列表。

因此:

路线有:

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]+'));

当我在结果页面中这样做时,它就是不起作用:

<?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')); ?>

它不会改变结果,它显示的结果与第1页相同。

你知道我哪里错了吗?

感谢AD7six提供的参考。

我的控制器需要:

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

紧随其后的是:

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

在视图文件中

最新更新