radekdostal / nette-visualpaginator
VisualPaginator Control for Nette Framework
2.0.0
2015-11-04 06:37 UTC
Requires
- php: >=5.4.0
- kdyby/translation: ^2.2.0
- nette/application: ^2.2.0
- nette/di: ^2.2.0
This package is auto-updated.
Last update: 2024-10-20 04:05:15 UTC
README
VisualPaginator Control for Nette Framework
- Author: Radek Dostál <radek.dostal@gmail.com>
- Copyright: Copyright (c) 2015 - 2016 Radek Dostál
- Licence: GNU Lesser General Public License
- Github: radekdostal/Nette-VisualPaginator
This add-on creates visual paginator with localizations and with optional "all" button. It supports custom localizations and custom templates (default template is designed for Bootstrap 3).
Requirements
- PHP 5.4 or later
- Nette Application 2.2 or later
- Nette DI 2.2 or later
- Kdyby/Translation 2.2 or later
GNU Lesser General Public License
LGPL licenses are very very long, so instead of including them here we offer you URLs with full text:
Example
config.neon
extensions: translation: Kdyby\Translation\DI\TranslationExtension visualPaginator: RadekDostal\NetteComponents\VisualPaginator\VisualPaginatorExtension translation: default: cs fallback: [cs_CZ, cs] whitelist: [cs, en] resolvers: # optional header: off visualPaginator: translator: @translation.default #template: '%appDir%/components/VisualPaginator/custom.latte' #viewButtonAll: TRUE
Kdyby\Translation looks for localizations in the directory app/lang. For example english localization file must be named visualPaginator.en_GB.neon (in case of using the NEON syntax).
Presenter
class DefaultPresenter extends BasePresenter { use \RadekDostal\NetteComponents\VisualPaginator\TVisualPaginator; public function renderDefault() { $paginator = $this['vp']->getPaginator(); $paginator->setItemsPerPage(1); $paginator->setItemCount(10); } /** * Creates the visual paginator * * @return \RadekDostal\NetteComponents\VisualPaginator\VisualPaginator */ protected function createComponentVp() { return $this->visualPaginator; } // For multiple paginators on the same page protected function createComponentVp2() { $control = $this->visualPaginator->create(); // $control->setTemplate(...); // Dynamic change localization $control->getTranslator()->setLocale('en'); return $control; } }
Template default.latte
{control vp}