PHP code example of venca-x / nette-pagination

1. Go to this page and download the library: Download venca-x/nette-pagination 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/ */

    

venca-x / nette-pagination example snippets


/** @var int shoved page in paginator */
private $paginatorOffset;

public function actionMy()
{
    //$vp = new VencaX\NettePagination\BootstrapRendererV4();
    $vp = new VencaX\NettePagination\BootstrapRendererV4($this, 'vp');
    $vp->setMaximalPagesCount( 5 );//maximal count pages in paginator
    $paginator = $vp->getPaginator();
    $paginator->itemsPerPage = 20;
    $paginator->itemCount = $this->modelTweets->findAll()->count( "*" );

    $this->paginatorOffset = $paginator->offset;

    $this->dataSelection = $this->modelTweets->findAll()->limit( $paginator->itemsPerPage, $paginator->offset );
    //...
}

public function renderMy()
{
    $this->template->paginatorOffset = $this->paginatorOffset;
}

$vp = new VencaX\NettePagination\BootstrapRendererV4();
$vp->setPreviousLabel('«');
$vp->setNextLabel('»');
//or
$vp = new VencaX\NettePagination\BootstrapRendererV3();
$vp->setPreviousLabel('«');
$vp->setNextLabel('»');

/** @var int shoved page in paginator */
private $paginatorOffset;

public function actionMy()
{
    $vp = new VencaX\NettePagination\BootstrapRendererV3();
    $vp->setMaximalPagesCount( 5 );//maximal count pages in paginator
    $paginator = $vp->getPaginator();
    $paginator->itemsPerPage = 20;
    $paginator->itemCount = $this->modelTweets->findAll()->count( "*" );

    $this->paginatorOffset = $paginator->offset;

    $this->dataSelection = $this->modelTweets->findAll()->limit( $paginator->itemsPerPage, $paginator->offset );
    //...
}

public function renderMy()
{
    $this->template->paginatorOffset = $this->paginatorOffset;
}