can't see pages with KnpPaginatorBundle

梦想的初衷 提交于 2019-12-25 02:24:57

问题


I got a form, that send post request and show paginated results. There are problems, when i want to see pages number 2 and more, because there sended get request and controller doesn't see form to create query. Anyone know how to solve this problem?


回答1:


I'm using symfony(1.4) and I dont know if there's a big difference between 2.x

so let me discuss about it...

creating url's you should use

<?php url_for('page/view?num='.$page_num) ?>

something like that, then you can now use the request of your module

@app/{apps_name}/module/page/{actions.class.php} or {pageActions.class.php}

to your view method

public function executeView(sfWebRequest $request)
{
   $page_num = $request->getParameter('num');
   echo $page_num;  
}

you should get what the page number now.

one more thing, this only works in $_GET requests.


You should know how to use Routing, to configure atleast 3 parameters. It will help you to use $_POST requests.




回答2:


I think easiest way would be to make the search a get request so that is in the url. Then the paginated links will have the search value too.



来源:https://stackoverflow.com/questions/20590124/cant-see-pages-with-knppaginatorbundle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!