Snippet codes and other stuff good to remember. Various source codes, tips and other things I encountered while working
Tuesday, May 03, 2016
Symfony - Navigation with "paginator"
{% if pagination.items|length %}
{% set queryParams = pagination.params %}
{% set pg = pagination.paginationData %}
{% set itemStart = (pg.current - 1)*pg.numItemsPerPage + 1 %}
Records {{ itemStart }} - {{ itemStart + pagination.items|length - 1 }} of {{ pg.totalCount }}
{# array (size=16)
'last' => int 2235
'current' => int 1
'numItemsPerPage' => int 9
'first' => int 1
'pageCount' => int 2235
'totalCount' => int 20112
'pageRange' => int 5
'startPage' => int 1
'endPage' => float 5
'next' => int 2
'pagesInRange' =>
array (size=5)
0 => int 1
1 => int 2
2 => int 3
3 => int 4
4 => int 5
'firstPageInRange' => int 1
'lastPageInRange' => int 5
'currentItemCount' => int 9
'firstItemNumber' => int 1
'lastItemNumber' => int 9#}
{% for entity in pagination %}
..
{% endfor %}
{% else %}
Your search returned no results
{% endif %}
{{ knp_pagination_render(pagination) }}
Subscribe to:
Comments (Atom)