PHP code example of surda / visual-paginator
1. Go to this page and download the library: Download surda/visual-paginator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
surda / visual-paginator example snippets
use Surda\VisualPaginator\TVisualPaginator;
use Surda\VisualPaginator\VisualPaginatorControl;
use Nette\Utils\Paginator;
class ProductPresenter extends Nette\Application\UI\Presenter
{
use TVisualPaginator;
public function actionDefault(): void
{
/** @var VisualPaginatorControl $vp */
$vp = $this->getComponent('vp');
/** @var Paginator $paginator */
$paginator = $vp->getPaginator();
$paginator->setItemsPerPage(20);
$paginator->setItemCount(500);
// $rows->limit($paginator->getItemsPerPage(), $paginator->getOffset());
}
}
class ProductPresenter extends Nette\Application\UI\Presenter
{
/**
* @return VisualPaginatorControl
*/
protected function createComponentIpp(): VisualPaginatorControl
{
$control = $this->visualPaginatorFactory->create();
$control->setEdges(1);
$control->setDisplayedPages(7);
$control->disableAjax();
$control->enableAjax();
return $control;
}
}