PHP code example of nattreid / visual-paginator
1. Go to this page and download the library: Download nattreid/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/ */
nattreid / visual-paginator example snippets
class SomePresenter {
function renderDefault() {
$model = $this->model->findAll();
$this['paginator']->setPagination($model);
$this->template->model = $model;
}
function createComponentPaginator() {
$paginator = new \NAttreid\VisualPaginator\VisualPaginator(10); // 10 polozek na strance, klasicke odkazy
$paginator = new \NAttreid\VisualPaginator\VisualPaginator(20); // 20 polozek na strance, ajax -> invalidace snippetu 'data'
$paginator->prev = 'Předchozí';
$paginator->next = 'Další';
$paginator->other = '...';
$paginator->setAjaxRequest(); // volani pres ajax
$paginator->setNoAjaxHistory(); // vypne historii pres ajax
$paginator->onClick[] = function(VPaginator $paginator, $page){
// php kod
};
return $paginator;
}
}