php namespace Redozote class Paginator extends Phalcon Mvc User Compon

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<?php namespace Redozote;
class Paginator extends \Phalcon\Mvc\User\Component {
public $data = null,
$currentPage,
$limit;
public function __construct($data, $currentPage, $limit) {
$currentPage = $currentPage ? $currentPage : 1;
$paginator = new \Phalcon\Paginator\Adapter\Model(
array(
'data' => $data,
'limit' => 4,
'page' => $currentPage
)
);
$page = $paginator->getPaginate();
return $page;
}
}