Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 522
HelioAraujo Avatar asked Feb 21 '23 18:02

HelioAraujo


2 Answers

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>
like image 81
Jihaisse Avatar answered Feb 24 '23 08:02

Jihaisse


Found this resource:

http://raw.zniper.net/bits/batching-in-custom-template

it worked very well.

Regards, Helio

like image 21
HelioAraujo Avatar answered Feb 24 '23 07:02

HelioAraujo