Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
850 views
in Technique[技术] by (71.8m points)

php - can't see pages with KnpPaginatorBundle

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...