[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::
<html>
<head>
<title tal:content="template/title">The title</title>
</head>
<body tal:define="employees here/getEmployees;
start python:path('request/start') or 0;
batch python:modules['ZTUtils'].Batch(employees,
size=10,
start=start);
previous python:batch.previous;
next python:batch.next">
<p>
<a tal:condition="previous"
tal:attributes="href string:${request/URL0}?start:int=${previous/first}"
href="previous_url">previous</a>
<a tal:condition="next"
tal:attributes="href string:${request/URL0}?start:int=${next/first}"
href="next_url">next</a>
</p>
<ul tal:repeat="employee batch" >
<li>
<span tal:replace="employee/name">Bob Jones</span>
makes $<span tal:replace="employee/salary">100,000</span>
a year.
</li>
</ul>
</body>
</html>
% 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;