A more friendly approach to EE channel pagination.
This feature is now available as part of EE2.3 and works almost identically. See the documentation for more information.
- Copy ext.ed_pagination.php to
system/expressionengine/third_party/ed_pagination
- Enable in the control panel
All the original pagination methods and malarkey are supported, but in addition you may use the ed_pages
tag pair.
href
the url to the paginated pagecur
a string containing ‘cur’ if the page in the loop is the current onepage_no
an integer of the current page int the looped_first_poge_href
the url to the first paginated pageed_last_page_href
the url to the last paginated page
{paginate}
{if "{total_pages}" > "1"} <div class="pagination"> <p>Page {current_page} of {total_pages}</p> <ul> <li class="first_page"><a href="{ed_first_page_href}">First page</a></li> {if previous_page} <li class="prev_page"><a href="{auto_path}"><</a></li> {/if} {ed_pages} <li class="{cur}"><a href="{href}">{page_no}</a></li> {/ed_pages} {if next_page} <li class="next_page"><a href="{auto_path}">></a></li> {/if} <li class="last_page"><a href="{ed_last_page_href}">Last page</a></li> </ul> </div><!-- //.pagination --> {/if}
{/paginate}
Which would output:
<p>Page 2 of 4</p>
<ul>
<li class="prev_page"><a href="/path/to/page/"><</a></li>
<li class=""><a href="/path/to/page/">1</a></li>
<li class="cur"><a href="/path/to/page/P5">2</a></li>
<li class=""><a href="/path/to/page/P10">3</a></li>
<li class=""><a href="/path/to/page/P15">4</a></li>
<li class="next_page"><a href="/path/to/page/P10">></a></li>
</ul>
That’s based on there being a limit of 5 in your entries tag.