1

我有 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 | 下一个 >

我需要这样的分页:当前:< Prev | 1 | 2 | 3 | ... 101 | 下一个 >

4

1 回答 1

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)

于 2019-05-06T13:18:28.537 回答