[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Page Templates

nobody@nowhere.com nobody@nowhere.com
Tue, 13 Aug 2002 10:16:55 -0400

A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AdvZPTold.stx#3-159


      Normally when you use batches you'll want to include navigation
      elements on the page to allow users to go from batch to batch.
      Here's a full-blow batching example that shows how to navigate
      between batches::

            <title tal:content="template/title">The title</title>
          <body tal:define="employees  here/getEmployees;
                            start python:path('request/start') or 0;
                            batch python:modules['ZTUtils'].Batch(employees, 
                            previous python:batch.previous;
                            next python:batch.next">

            <a tal:condition="previous"
               tal:attributes="href string:${request/URL0}?start:int=${previous/first}"
            <a tal:condition="next"
               tal:attributes="href string:${request/URL0}?start:int=${next/first}"

          <ul tal:repeat="employee batch" >
              <span tal:replace="employee/name">Bob Jones</span>
              makes $<span tal:replace="employee/salary">100,000</span>
              a year.


        % Anonymous User - Aug. 13, 2002 10:16 am:
         I copied the PT, and the line:

             start python:path('request/start') or 0;

         gave me an error:

             Error Value: start not found in 'request/start', at line 10, column 3 

         what works fine is:

             start request/start | python:0;