artfocus / visual-paginator
Visual Paginator for Nette Framework
v1.0.2
2016-07-05 17:43 UTC
Requires
- php: >= 5.6
- nette/application: ^2.3
- nette/di: ^2.3
- nette/http: ^2.3
- nette/utils: ^2.3
Requires (Dev)
- doctrine/orm: ^2.5
This package is not auto-updated.
Last update: 2024-11-09 20:17:33 UTC
README
Installation
$ composer require artfocus/visual-paginator
Setup
Register Artfocus\VisualPaginator\VisualPaginatorFactory
as a Service in your DI.
# app/config.neon services: - Artfocus\VisualPaginator\VisualPaginatorFactory
Example usage (with Doctrine)
<?php 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); } }
{* Article/default.latte *} {block content} <ul n:inner-foreach="$articles as $article"> <li>{$article->getTitle()}</li> </ul> {control paginator} {/block}