Customize the pagination markup
12
Given you have a Paginator
instance stored in a $results
variable:
$this['results'] = YourModel::paginate(10);
You can output the default pagination markup using the | raw
filter:
{{ results | raw }}
If you need to customize the markup of the pagination you'll have to generate it yourself:
{% if results.hasPages %}
<ul class="pagination">
<li>
{% if results.currentPage > 1 %}
<a href="{{ results.previousPageUrl }}" rel="prev">«</a>
{% else %}
<span class="disabled">«</span>
{% endif %}
</li>
{% for page in range(1, results.lastPage) %}
<li>
<a href="{{ results.url(page) }}">{{ page }}</a>
</li>
{% endfor %}
<li>
{% if results.hasMorePages %}
<a href="{{ results.nextPageUrl }}" rel="next">»</a>
{% else %}
<span class="disabled">»</span>
{% endif %}
</li>
</ul>
{% endif %}
Hi there! That helped me a lot! Thanks! Small side-question: any idea how to create a paginator like this:
<< 1, 2, 3 .... 8, 9, 20>>
In case one has a lot of pages (like me) ;)
try this one. https://stackoverflow.com/questions/50509696/custom-pagination-in-octobercms
It's possible to create a pagination in the bluiderList ?