HelioAraujo
HelioAraujo

Reputation: 299

Pagination via page template in Plone

I'm looking for a example on how to use the Batch TAL macro for pagination of folder contents. Up to know didn't find any that explains what to do. Does anyone know of such an example?

Thanks in advance.

Regards, Helio

Upvotes: 4

Views: 1090

Answers (1)

Jihaisse
Jihaisse

Reputation: 977

Something like that ?

<div tal:define="liste python:here.portal_catalog.searchResults({'portal_type' : 'News Item',   'review_state':'published'});
             Batch python:modules['Products.CMFPlone'].Batch;
             b_size python:20;
             b_start python:0;
             b_start request/b_start | b_start;
             batch python:Batch(liste, b_size, int(b_start), orphan=1);"
     tal:condition="liste">

    <ul>

        <tal:boucle tal:repeat="item batch">
            <li tal:define="oddrow repeat/item/odd;" 
                tal:attributes="class python:test(oddrow, 'even', 'odd')">

                 <!-- stuff -->

            </li>
        </tal:boucle>

    </ul>

    <div metal:use-macro="here/batch_macros/macros/navigation" />

</div>

Upvotes: 6

Related Questions