Created
May 10, 2019 00:06
-
-
Save piotrpog/dc740c96b0ab2cdecbae9b3092950e05 to your computer and use it in GitHub Desktop.
Pagination template component for Craft CMS. List of pages is rendered using <select> HTML element. More info: http://craftsnippets.com/articles/ellipsis-pagination-component-for-craft-cms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# settings #} | |
{% set info = pageInfo %} | |
{# logic #} | |
{% if info.totalPages > 1 %} | |
<select name="" id="" onchange="document.location.href = this.options[this.selectedIndex].value;"> | |
{% for link in info.getRangeUrls( 1, info.totalPages ) %} | |
<option value="{{link}}" {{info.currentPage == loop.index ? 'selected="selected"'}}>{{'page'|t}} {{loop.index}}</option> | |
{% endfor %} | |
</select> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment