pagination
This commit is contained in:
@ -14,17 +14,18 @@ class Pagination
|
||||
|
||||
private string $baseUrl;
|
||||
|
||||
public function __construct($countItem, $perPage, $currentPage, $baseUrl)
|
||||
// public function __construct($countItem, $perPage, $currentPage, $baseUrl)
|
||||
public function __construct(int $countItem, array $params, string $baseUrl)
|
||||
{
|
||||
$this->countItem = $countItem;
|
||||
$this->perPage = $perPage;
|
||||
$this->currentPage = $currentPage;
|
||||
$this->perPage = $params['perPage'];
|
||||
$this->currentPage = $params['currentPage'];
|
||||
$this->baseUrl = $baseUrl;
|
||||
|
||||
$this->countPages = ceil($this->countItem / $perPage);
|
||||
$this->countPages = ceil($this->countItem / $this->perPage);
|
||||
}
|
||||
|
||||
public function create()
|
||||
public function create(): void
|
||||
{
|
||||
$prev = $this->currentPage - 1 >= 1 ? $this->currentPage - 1 : null;
|
||||
$next = $this->currentPage + 1 <= $this->countPages ? $this->currentPage + 1 : null;
|
||||
@ -42,12 +43,17 @@ class Pagination
|
||||
echo $this->html;
|
||||
}
|
||||
|
||||
public function fetch()
|
||||
public function fetch(): string
|
||||
{
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
private function getTemplate()
|
||||
public function hookBefore(): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function getTemplate(): string
|
||||
{
|
||||
return '<nav aria-label="Page navigation example">
|
||||
<ul class="pagination">
|
||||
|
Reference in New Issue
Block a user