app/template/default/pager.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% if pages.pageCount > 1 %}
  9.     <div class="mx-auto mt-20 flex w-full justify-between items-center gap-6 md:gap-3 md:w-full text-sm leading-normal">
  10.         {# 前のページへ #}
  11.         {% if pages.current > 1 %}
  12.             <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'route': app.request.attributes.get('route'), 'pageno': pages.current - 1})) }}" class="size-9">
  13.                 <img src="{{ asset('assets/img/info/Link.svg') }}" alt="Previous" style="transform: scaleX(-1);">
  14.             </a>
  15.         {% else %}
  16.             <span class="size-9"></span>
  17.         {% endif %}
  18.         <div class="flex justify-center gap-2 md:gap-1">
  19.             {# 最初へ #}
  20.             {% if pages.firstPageInRange != 1 %}
  21.                 <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'route': app.request.attributes.get('route'), 'pageno': pages.first})) }}">1</a>
  22.                 <span>|</span>
  23.             {% endif %}
  24.             {# 1ページリンクが表示されない場合、「...」を表示 #}
  25.             {% if pages.firstPageInRange != 1 %}
  26.                 <p>...</p>
  27.                 <span>|</span>
  28.             {% endif %}
  29.             {# ページ番号リンクを表示 #}
  30.             {% for page in pages.pagesInRange %}
  31.                 {% if page == pages.current %}
  32.                     <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'route': app.request.attributes.get('route'), 'pageno': page})) }}" class="underline">
  33.                         {{ page }}
  34.                     </a>
  35.                 {% else %}
  36.                     <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'route': app.request.attributes.get('route'), 'pageno': page})) }}">
  37.                         {{ page }}
  38.                     </a>
  39.                 {% endif %}
  40.                 {% if not loop.last %}
  41.                     <span>|</span>
  42.                 {% endif %}
  43.             {% endfor %}
  44.             {# 最終ページリンクが表示されない場合、「...」を表示 #}
  45.             {% if pages.last != pages.lastPageInRange %}
  46.                 <span>|</span>
  47.                 <p>...</p>
  48.                 <span>|</span>
  49.             {% endif %}
  50.             {# 最後へ #}
  51.             {% if pages.last != pages.lastPageInRange %}
  52.                 <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'route': app.request.attributes.get('route'), 'pageno': pages.last})) }}">
  53.                     {{ pages.last }}
  54.                 </a>
  55.             {% endif %}
  56.         </div>
  57.         {# 次のページへ #}
  58.         {% if pages.current < pages.pageCount %}
  59.             <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'route': app.request.attributes.get('route'), 'pageno': pages.current + 1})) }}" class="size-9">
  60.                 <img src="{{ asset('assets/img/info/Link.svg') }}" alt="Next">
  61.             </a>
  62.         {% else %}
  63.             <span class="size-9"></span>
  64.         {% endif %}
  65.     </div>
  66. {% endif %}