Configure KnpPaginator to work with Twitter Bootstrap

后端 未结 2 1461
醉酒成梦
醉酒成梦 2021-02-09 08:06

\"Vendor
i\'m trying to apply twitter bootstrap css style to my knp pagination without modifying the vendor.

2条回答
  •  死守一世寂寞
    2021-02-09 08:23

    Yes, in your config.yml and your knp_paginator settings:

    knp_paginator:
        template:
             pagination: AcmeBundle:Common:paginator-bootstrap.html.twig
    

    and then in paginator-bootstrap.html.twig

    {% if pageCount > 1 %}
        
      {% if first is defined and current != first %}
    • <<
    • {% endif %} {% if previous is defined %} {% endif %} {% for page in pagesInRange %} {% if page != current %}
    • {{ page }}
    • {% else %}
    • {{ page }} (current)
    • {% endif %} {% endfor %} {% if next is defined %} {% endif %} {% if last is defined and current != last %}
    • >>
    • {% endif %}
    {% endif %}

提交回复
热议问题