Search code examples
paginationexpressionengine

Pagination on Single-Entry view in ExpressionEngine


I am building a website with ExpressionEngine as the CMS. There is a "Work" section that displays all the projects, and a detail view that shows each project individually. It is at this point, on the single-entry view that I would like to have "prev" and "next" pagination. In my tests I have made it work when the URL is "somedomain.com/index.php/work/detail/" but it does not work when the specific entry is part of the URL: "somedomain.com/index.php/work/detail/some_project/"

I've tried putting the pagination code outside of the {exp:weblog:entries} tag as well as within it, but to no avail. This is what my pagination code looks like:

{paginate}
    <ul>
        {if previous_page}
        <li><a href="{auto_path}">< previous</a></li>
        {/if}

        {if next_page}
        <li><a href="{auto_path}">next ></a></li>
        {/if}
    </ul>
{/paginate}

Solution

  • You are using pagination for lists of entries, what you need is the next / previous entry tags:

    http://expressionengine.com/user_guide/modules/channel/entry_linking.html