Search code examples
symfonyknppaginator

Show how many pages in Knp pagination


I install and override template in knp pagination. But I need show how many pages are. For example: 1 page of 10, 5 page of 10 e.t.c?I read offical documentation but I dosen't find ansver.


Solution

  • You can override this template : https://github.com/KnpLabs/KnpPaginatorBundle/blob/master/Resources/views/Pagination/sliding.html.twig

    Just use the variable pageCount to display the amount of pages where you want.

    To do so, create a sliding.html.twig file in your app/Resources/KnpPaginatorBundle/views/Pagination folder.