When having much of items to display, like inside a news category, we should break it into pages. It looks somehow like this:
Plone has a Batch class which supports above feature, staying at Products.CMFPlone.Batch. If you utilize (inherited) some existing folder views, you could already have it (the batch & navigation) present inside the template. If not, we could put that in manually. Here are the steps:
1. Inside the template, declare the Batch class:
2. Determine the list or method returning list of items. Here in this example is getting all Documents via portal catalog:
3. Set some variables, and creating batch object:
per_page python:request.get('per_page', 5);
batch python:isinstance(all_items, Batch) and items or Batch(items, per_page, int(b_start), orphan=1);"
From here, you could use the batch as the list of items for displaying
<div class="item-title" tal:content="item/pretty_title_or_id | nothing" />
<div class="item-description" tal:content="item/Description | nothing" />
</div>
4. That is not complete yet, we still need the navigation which displays the pages, next, previous links,... This one is extremely simple, just using this macro (put it anywhere you want, anywhere == $places-inside-step3-scope):
- Here are an useful source: http://plone.org/documentation/kb/plonebatch