Create a pagination with array data.
App::Utility()->arrayPaginator(List,[Options])
Parameter |
Description |
---|---|
List |
List of array element to paginate |
Options |
Set limit and Page Link |
See bellow example:
$list = array(
array('A','B','C'),
array('D','D','F'),
array('G','H','I'),
array('J','K','L'),
array('M','N','O')
);
$data = App::Utility()
->arrayPaginator(
$list,
array('limit'=>2,'h_link'=>'?x=y')
);
pre($data);
/*
Return Value:
Array
(
[data] => Array
(
[0] => Array
(
[0] => G
[1] => H
[2] => I
)
[1] => Array
(
[0] => J
[1] => K
[2] => L
)
)
[paging] => <a href="?x=y&page=1" class="page_previous" title="Previous">Previous</a> | <a href="?x=y&page=3" class="page_next" title="Next">Next</a>
[link] => Showing Results 3-4 of 5
[total] => 5
[page] => 2
[paging_str] => <div class="pagination pagination-left">
<div class="results">
<span>Showing Results 3-4 of 5</span>
</div>
<ul class="pager">
<li><a href="?x=y&page=1" class="page_previous" title="Previous">Previous</a></li>
<li><a href="?x=y&page=1">1</a> </li><li class="current">2</li><li><a href="?x=y&page=3">3</a> </li>
<li><a href="?x=y&page=3" class="page_next" title="Next">Next</a></li>
</ul>
</div>
)
*/