M
M
magary42016-10-26 10:33:13
symfony
magary4, 2016-10-26 10:33:13

How to draw a pager?

I had experience using pagerfanta,
but something is not very good for me, it’s too redundant
or maybe I didn’t understand all the “salt” then,
in order to draw a pager, I need 3 variables current, total, perpage and mustache, and pagerfanta uses an adapter, fetches pages itself, etc.
I see 3 options:
- twig function
- twig macro - {% include " pager.html.twig
" with { total: 69, perpage:15 } %}
what to choose?
do all 3 options do the same thing or is there an option when it is better to use one or the other?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2016-10-26
@riky

I use KnpPagination, I'm happy, but judging by your description, it's no less "redundant".
According to your options, the main hemorrhoids will be with path generation, though if the template is not universal, then there are no problems. Then imagine you want to add sorting, then filters, all of them will need to be taken into account in the pager.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question