我与Pagerfanta分页。我想将页码限制为5,因为在移动版上分页太大。我正在使用默认视图'twitter_bootstrap_translated'。
{% if articles.haveToPaginate %}
<div class="pagination-class">
{{ pagerfanta(articles, 'twitter_bootstrap_translated', {routeName: 'search_result_paginated', routeParams: app.request.query.all}) }}
</div>
{% endif %}
如何限制页码/链接?
当前:<上一页| 1 | 2 | 3 | 4 | 5 | 6 | 7 | ... 101 |下一个>
我需要这样的分页: 当前:<上一页| 1 | 2 | 3 | ... 101 |下一个>
答案 0 :(得分:1)
请看一下可能会有用:
<?php
use Pagerfanta\View\TwitterBootstrapView;
$view = new TwitterBootstrapView();
$options = array('proximity' => 3);
$html = $view->render($pagerfanta, $routeGenerator, $options);
Options (default):
proximity (3)
prev_message (← Previous)
prev_disabled_href ()
next_message (Next →)
next_disabled_href ()
dots_message (…)
dots_href ()
css_container_class (pagination)
css_prev_class (prev)
css_next_class (next)
css_disabled_class (disabled)
css_dots_class (disabled)
css_active_class (active)