问题
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