Pagination on Single-Entry view in ExpressionEngine
I am building a we开发者_如何学Cbsite 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}
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
Hmm. I'm not sure what the issue is here, as I've never used the {pagination}
tag in that way. After checking out the docs, I see that the example code for prev/next links inside of the {pagination}
tag is wrapped inside of an {exp:comment:entries}
loop instead of the normal {exp:channel:entries}
loop.
The docs aren't very clear about the scope of this particular feature of the {pagination}
tag. You might want to double check that, in your {exp:channel:entries}
loop, you haven't included pagination as a value in the disable
parameter.
You could also check out the page in EE's user guide about Next/Prev Linking, which details the use of {exp:channel:next_entry}
and {exp:channel:prev_entry}
tags in place of the {pagination}
tag that you've been using. I've used these tags without a hitch, so I definitely recommend trying them if you can't get your method to work.
Best of luck!
精彩评论