pkshetlie/pagination-bundle
Composer 安装命令:
composer require pkshetlie/pagination-bundle
包简介
Easy way to make html table with paginations
README 文档
README
composer require pkshetlie/pagination-bundle
add to AppKernel.php
[
...
new Pkshetlie\PaginationBundle\PaginationBundle(),
...
]
Add to config.yml
imports: ... - { resource: "@PaginationBundle/Resources/config/services.yml" }
installation is done.
Exemple Usage
in some Dummy controller
class DummyController extends Controller{ public function indexAction(Request $request){ $qb = $this->getDoctrine()->getReposiitory('DummyBundle:DummyEntity')->createQueryBuilder('x'); // you can add some /* $qb->orderBy( ... ) $qb->where( ... ) ... */ $pagination = $this->get('pkshetlie.pagination')->process($qb, $request); return $this->render('DummyBundle:Dummy:index.html.twig',[ 'pagination'=> $pagination, ]); } }
in the index.html.twig
{% import '@Pagination/Pagination/macro.twig' as macro_pagination %}
<table>
{% for entity in pagination.entities %}
{# ... your stuff with <tr> / <td> #}
{% endfor %}
</table>
{# draw the pagination #}
{{ macro_pagination.paginate(pagination) }}
that's all !
统计信息
- 总下载量: 546
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2018-03-26