Skip to content

Instantly share code, notes, and snippets.

@froulet
Last active July 2, 2018 07:43
Show Gist options
  • Save froulet/417b87ed61c0a28df5f247a8849f087c to your computer and use it in GitHub Desktop.
Save froulet/417b87ed61c0a28df5f247a8849f087c to your computer and use it in GitHub Desktop.
Bulma.io v0.6.2 Twig template for Symfony 3.4 pagination
{# bulma Sliding pagination control implementation #}
{% if pageCount > 1 %}
<div class="columns">
<div class="column">
</div>
<div class="column">
<ul>
<span>
{% if previous is defined %}
<a class="button" href="{{ path(route, query|merge({(pageParameterName): previous})) }}">&lt;</a>
{% else %}
<a class="button" disabled>&lt;</a>
{% endif %}
</span>
<span>
<a class="button" href="{{ path(route, query|merge({(pageParameterName): first})) }}">1</a>
</span>
{% if pagesInRange[0] - first >= 2%}
<span>
<span>&nbsp;...&nbsp;</span>
</span>
{%endif %}
{% for page in pagesInRange %}
{% if first != page and page != last %}
<span>
<a class="button" href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a>
</span>
{% endif %}
{% endfor %}
{% if last - pagesInRange[pagesInRange|length - 1] >= 2 %}
<span>
<span>&nbsp;...&nbsp;</span>
</span>
{%endif %}
<span>
<a class="button" href="{{ path(route, query|merge({(pageParameterName): last})) }}">{{last}}</a>
</span>
<span>
{% if next is defined %}
<a class="button" href="{{ path(route, query|merge({(pageParameterName): next})) }}">&gt;</a>
{% else %}
<a class="button" disabled>&gt;</a>
{%endif%}
</span>
</ul>
</div>
<div class="column">
</div>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment