一旦我使用CakePHP 2.3排序链接,它可以工作,但不会更改页面的URL:1,这意味着如果用户现在在页面中:16,在点击另一个排序链接后,他将在页面上:16,但是在不同的排序 - 真的很混乱。当他按日期浏览结果时,达到16页并点击按价格排序,他按价格按16页排序。用户界面完全混淆。怎么解决?谢谢!
echo $this->Paginator->sort('title', 'Title', array('direction' => 'desc', 'page'=>1));
我使用自定义函数,如:
echo $ this-> MyHelper-> sort(...);
在MyHelper类中:
var $helpers = array('Paginator');
public function sort($key, $title = null, $options = array()) {
$options['url'] = array('page' => 1);
return $this->Paginator->sort($key, $title, $options);
}
另外,我建议使用以下命令切换到查询字符串而不是命名参数:
'Paginator' => array(
'limit' => 15,
'paramType' => 'querystring'
),
定义组件时。