tadcka / paginator-bundle
Symfony2 管理分页
v0.1.0
2014-03-27 20:32 UTC
Requires
- php: >=5.3.3
- symfony/framework-bundle: >=2.3
- tadcka/paginator: ~1.0
This package is not auto-updated.
Last update: 2024-09-24 02:08:36 UTC
README
分页包。
安装
步骤 1: 使用 composer 下载 TadckaPaginatorBundle
在 composer.json 中添加 TadckaPaginatorBundle
{ "require": { "tadcka/paginator-bundle": "dev-master" } }
现在运行命令让 composer 下载包
$ php composer.phar update tadcka/paginator-bundle
步骤 2: 启用包
在 kernel 中启用包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Tadcka\PaginatorBundle\TadckaPaginatorBundle(), ); }
如何使用?
步骤 3: 如何使用?
创建分页对象
<?php $pagination = new \Tadcka\Component\Paginator\Pagination($totalItems, $currentPage, $itemsPerPage);
渲染 HTML
<?php $paginationHtml = $this->container->get('tadcka_paginator.manager')->getPaginatorHtml($pagination);
步骤 4: 配置
tadcka_paginator: max_near_pages: 3 template_class: pagination: test pagination_links: test_links pagination_link: test_link