17 October 2010

Author

Jan Vantomme

Tags

A Better Pagination Template for ExpressionEngine

When you want to use the Next Page / Previous Page pagination in ExpressionEngine, there is no option to display a disabled button when you are at the first or last article in the current channel. The template below is a workaround for this problem.

{paginate}
<div id="pagination">
    <ul>
    {if "{current_page}" == 1}
        <li><span id="prev-disabled">Previous Page</span></li>
    {/if}
    {if previous_page}
        <li><a href="{auto_path}" id="prev">Previous Page</a></li>
    {/if}
    {if "{current_page}" == "{total_pages}"}
        <li><span id="next-disabled">Next Page</span></li>
    {/if}
    {if next_page}
        <li><a href="{auto_path}" id="next">Next Page</a></li>
    {/if}
    </ul>
</div>
{/paginate}

Browse Articles

Comments (1)

From:Sean
Date:22.12.2010

Gravatar for Sean

This is very helpful, thanks! Much nicer than having the previous and next links shift position.

Top · Permanent link to this comment

Commenting is closed for this article.
Commenting is not available in this channel entry.