I am trying to get the current index of the item that is current displaying in knp paginator bundle, atm i have something like this:
{% for index, post in posts %}
{{ index + 1 }}
{% endfor %}
However this only displays for example 1 - 10, even when i am on page 2. It is supposed to show items 11-20 on page, 21-30 on page 3,... but it gets reset every time.
I solved it by using:
{{ pagination.getItemNumberPerPage * (pagination.getCurrentPageNumber - 1) + index + 1 }}
but this is a very messy solution which i don't want to use.
Are there any alternatives for this?