poznet / arraypaginator
Simple array pagination in view
dev-master
2021-06-15 17:14 UTC
Requires
- php: >=5.3
This package is auto-updated.
Last update: 2024-10-16 00:23:09 UTC
README
Simple Array Pagginator Bundle for Symfony 2
As long as you paginate query elements ( using for example KNP Paginator Bundle ) there is no problem, but sometimes there is a need to paginate array elements in view.
I got problem with implementation KNPPaginatorBundle to paginate elements of array , so i created this.
###Installation
Simple :
composer require poznet/arraypaginator
###Usage
in parameters
define how much element's you want to show on eah page :
parameters:
poznet_array_paginator:
- perpage: 9
in Controller
$tab=array();
$pagination=$this->get('poznet.array.paginator')->paginate($tab);
return array('pagination'=>$pagination);
in View
- render array elements as normally ( foreach )
- in place where you want to have pagination add twig function
{{ pagination() }}
TODO
in future :
- some better routing (cofigured by parameters)
- using views togenerate pagination
Licence
This Bundle is licensed under the MIT License. Feel free to contribute.