cakePHP paginate with post data without sessions, serialization or post to get

前端 未结 5 817
难免孤独
难免孤独 2021-01-12 21:49

I have created a small search and filter form with a POST action in controller/index, which POSTs to itself the conditions and fields to paginate ($this->paginate($

5条回答
  •  终归单人心
    2021-01-12 22:22

    You can use passedArgs.

    in the method controller :

    if ( empty($this->passedArgs['search']) ){
        $this->passedArgs['search'] = $this->data['YourModel']['search'];
    }
    if ( empty($this->data) ){
        $this->data['YourModel']['search'] = $this->passedArgs['search'];
    }
    

    in your view :

    $this->Paginator->options(array('url' => $this->passedArgs));
    

提交回复
热议问题