php - Symfony2 Pager Fanta

389

Is it posible to set the route / render controller with pager fanta in symfony2 because i have tried rendering a controller and it hits me with cannot generate route:

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "" as such route does not exist.") in @AppBundle\Survey\table_questions.html.twig at line 27.

On line 27 i have

{{ pagerfanta(pager, 'twitter_bootstrap3') }}
485

Answer

Solution:

try like this

{{ pagerfanta(pager, 'twitter_bootstrap3', {'routeName': 'your_route_name'}) }}
17

Answer

Solution:

I don't know how exactly you use theWhiteOctoberPagerfantaBundle but you can set your default view: https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle#adding-views. Also see this answer: Customising the layout of Pagerfanta pagination with a custom template.

Alternatively, thepagerfanta function takes a third argument with options to create the route generator. https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle/blob/master/Twig/PagerfantaExtension.php#L100.

NotablyrouteName might be enough for what you need to do:

{{ pagerfanta(pager, 'twitter_bootstrap3', {routeName: 'route_name'}) }}

People are also looking for solutions to the problem: php - laravel get last bid from each post

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.