Skip to content

Instantly share code, notes, and snippets.

@sotarok
Created January 5, 2012 04:41
Show Gist options
  • Save sotarok/1563748 to your computer and use it in GitHub Desktop.
Save sotarok/1563748 to your computer and use it in GitHub Desktop.
{#
# ref: PaginatorBudnel:Pagination:sliding.html.twig
# with twitter bootstrap
#}
{% if pageCount > 1 %}
<div class="pagination">
<ul>
{% if first is defined and current != first %}
<li class="prev">
<a href="{{ path(route, query|merge({'page': first})) }}">&lt;&lt;</a>
</li>
{% else %}
<li class="prev disabled"><a href="{{ path(route, query|merge({'page': first})) }}">&lt;&lt;</a></li>
{% endif %}
{% if previous is defined %}
<li class="prev">
<a href="{{ path(route, query|merge({'page': previous})) }}">&lt;</a>
</li>
{% endif %}
{% for page in pagesInRange %}
<li {% if page == current %}class="active"{% endif %}><a href="{{ path(route, query|merge({'page': page})) }}"> {{ page }} </a></li>
{% endfor %}
{% if next is defined %}
<li class="next">
<a href="{{ path(route, query|merge({'page': next})) }}">&gt;</a>
</li>
{% endif %}
{% if last is defined and current != last %}
<li class="next">
<a href="{{ path(route, query|merge({'page': last})) }}">&gt;&gt;</a>
</li>
{% else %}
<li class="next disabled">
<a href="{{ path(route, query|merge({'page': last})) }}">&gt;&gt;</a>
</li>
{% endif %}
</ul>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment