PHP code example of artfocus / visual-paginator

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

    

artfocus / visual-paginator example snippets





namespace App\Presenters;

use App\Facade\ArticleFacade;
use Artfocus\VisualPaginator;

class ArticlePresenter extends BasePresenter
{

	use VisualPaginator\VisualPaginatorTrait;

	/**
	 * @var ArticleFacade
	 * @inject
	 */
	public $articleFacade;

	public function renderDefault()
	{
		// Get instance of Doctrine\ORM\Tools\Pagination\Paginator
		$articles = $this->articleFacade->findByTag('new');
		
		// Apply pagination - 10 items per page.
		$this->template->articles = VisualPaginator\DoctrineHelper::apply($articles, $this->getComponent('paginator'), 10);
	}

}