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

前端 未结 5 815
难免孤独
难免孤独 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:03

    Is there an un complex way to pass the post conditions to the other paginated pages?

    Nope.

    Is there an good cake way to do this more like passArgs, sessions and url encode do not look like cake style.

    There is only one way, no matter, cake or not cake.

    1. Search must be done using GET method.

    2. Parameters being passed via QUERY STRING.

    So, make your search form with method="GET" and then use http_build_query() to assemble a query string and use it to make links to other pages.

    Being a little curious, you can see an example right here on SO:

    http://stackoverflow.com/questions/tagged?tagnames=php&page=5&sort=newest&pagesize=50
    

提交回复
热议问题