Zope ZPT Using global variables to track totals

This is ideally done in a python script, but for very simple cases, as seen here, it is acceptable.
<tal:qty define="global total_quantity python: 0;" />
<tr tal:repeat="item results">
	<td tal:content="item/item"></td>
	<td tal:content="item/quantity" 
	    tal:define="global total_quantity python: total_quantity + item['quantity']">
	<dt>Total Items</dt>
	<dd tal:content="total_quantity" />
Posted by
Snippet Viewed 1656 times.

Share your Zope ZPT code snippets:

  • Get some recognition & link back to your site.


Submit | Browse

Most Recent zope zpt snippets

Most Viewed