comparison doc/customizing.txt @ 2855:874bf6abad42

doc for repeat variable
author Richard Jones <richard@users.sourceforge.net>
date Wed, 03 Nov 2004 01:10:53 +0000
parents deb298529c2b
children 0357a9c93933
comparison
equal deleted inserted replaced
2854:6acc315570eb 2855:874bf6abad42
1 =================== 1 ===================
2 Customising Roundup 2 Customising Roundup
3 =================== 3 ===================
4 4
5 :Version: $Revision: 1.147 $ 5 :Version: $Revision: 1.148 $
6 6
7 .. This document borrows from the ZopeBook section on ZPT. The original is at: 7 .. This document borrows from the ZopeBook section on ZPT. The original is at:
8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
9 9
10 .. contents:: 10 .. contents::
1367 <td tal:content="u/username"></td> 1367 <td tal:content="u/username"></td>
1368 <td tal:content="u/realname"></td> 1368 <td tal:content="u/realname"></td>
1369 </tr> 1369 </tr>
1370 1370
1371 The example would iterate over the sequence of users returned by 1371 The example would iterate over the sequence of users returned by
1372 "user/list" and define the local variable "u" for each entry. 1372 "user/list" and define the local variable "u" for each entry. Using
1373 the repeat command creates a new variable called "repeat" which you
1374 may access to gather information about the iteration. See the section
1375 below on `the repeat variable`_.
1373 1376
1374 **tal:replace="expression"** 1377 **tal:replace="expression"**
1375 Replace this tag with the result of the expression. For example:: 1378 Replace this tag with the result of the expression. For example::
1376 1379
1377 <span tal:replace="request/user/realname" /> 1380 <span tal:replace="request/user/realname" />
1972 templates/name/macros/macro_name 1975 templates/name/macros/macro_name
1973 1976
1974 or the python expression:: 1977 or the python expression::
1975 1978
1976 templates[name].macros[macro_name] 1979 templates[name].macros[macro_name]
1980
1981 The repeat variable
1982 ~~~~~~~~~~~~~~~~~~~
1983
1984 The repeat variable holds an entry for each active iteration. That is, if
1985 you have a ``tal:repeat="user db/users"`` command, then there will be a
1986 repeat variable entry called "user". This may be accessed as either::
1987
1988 repeat/user
1989 python:repeat['user']
1990
1991 The "user" entry has a number of methods available for information:
1992
1993 =============== =========================================================
1994 Method Description
1995 =============== =========================================================
1996 first True if the current item is the first in the sequence.
1997 last True if the current item is the last in the sequence.
1998 even True if the current item is an even item in the sequence.
1999 odd True if the current item is an odd item in the sequence.
2000 number Current position in the sequence, starting from 1.
2001 letter Current position in the sequence as a letter, a through
2002 z, then aa through zz, and so on.
2003 Letter Same as letter(), except uppercase.
2004 roman Current position in the sequence as lowercase roman
2005 numerals.
2006 Roman Same as roman(), except uppercase.
2007 =============== =========================================================
1977 2008
1978 2009
1979 The utils variable 2010 The utils variable
1980 ~~~~~~~~~~~~~~~~~~ 2011 ~~~~~~~~~~~~~~~~~~
1981 2012

Roundup Issue Tracker: http://roundup-tracker.org/