如何自定义knp paginator的按钮

时间:2016-05-14 19:57:13

标签: symfony pagination symfony-2.6 knppaginator knppaginatorbundle

我在我的项目中集成了knp bundle,但是paginator的按钮就像那样

enter image description here

如何在我的模板中制作按钮

enter image description here

<div id="blog_pagination" class="pagination pagination-centered clearfix">
                    <a class="next page-numbers" href="#"><i class="ci_icon-chevron-left"></i></a>
                    <span class="page-numbers current">1</span>
                    <a class="page-numbers" href="#">2</a>
                    <a class="next page-numbers" href="#"><i class="ci_icon-chevron-right"></i></a>
                </div>

1 个答案:

答案 0 :(得分:3)

根据文档,在配置文件中:

// app/config/config.yml

knp_paginator:
        page_range: 5                      # default page range used in pagination control
        default_options:
            page_name: page                # page query parameter name
            sort_field_name: sort          # sort field query parameter name
            sort_direction_name: direction # sort direction query parameter name
            distinct: true                 # ensure distinct results, useful when ORM queries are using GROUP BY statements
        template:
            pagination: KnpPaginatorBundle:Pagination:sliding.html.twig     # sliding pagination controls template
            sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template

更改boostrap模板的默认模板:

pagination: KnpPaginatorBundle:Pagination:sliding.html.twig 

for(boostrap 3)

pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig

或(boostrap 1和2)

pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_pagination.html.twig