CakePHP pagination and the get parameters

前端 未结 8 800
逝去的感伤
逝去的感伤 2021-02-02 02:31

I have a problem with the pagination in my search page. When a user search something I have a url like domain.com/search/?s=keyword but paginator gives me links lik

8条回答
  •  没有蜡笔的小新
    2021-02-02 03:19

    Check this comment.

    I used it, it works fine.

    in app_controller file:

    function _paginatorURL() {
      $passed = "";
      $retain = $this->params['url'];
      unset($retain['url']);
      $this->set('paginatorURL',array($passed, '?' => http_build_query($retain)));
    }
    
    function beforeFilter()
    {
      $this->_paginatorURL();
    }
    

    in views file:

      options = array( 'url' => $paginatorURL );?>
    

    Hope it helps.

提交回复
热议问题