can't see pages with KnpPaginatorBundle

253 Views Asked by At

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?

2

There are 2 best solutions below

5
On

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.

0
On

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.