comparison doc/customizing.txt @ 2857:53c0c18b59c6 maint-0.7

merge from HEAd
author Richard Jones <richard@users.sourceforge.net>
date Wed, 03 Nov 2004 02:57:37 +0000
parents 9e1c4c932323
children a204a49e0974
comparison
equal deleted inserted replaced
2831:d57c06dcb4c2 2857:53c0c18b59c6
1335 <td tal:content="u/username"></td> 1335 <td tal:content="u/username"></td>
1336 <td tal:content="u/realname"></td> 1336 <td tal:content="u/realname"></td>
1337 </tr> 1337 </tr>
1338 1338
1339 The example would iterate over the sequence of users returned by 1339 The example would iterate over the sequence of users returned by
1340 "user/list" and define the local variable "u" for each entry. 1340 "user/list" and define the local variable "u" for each entry. Using
1341 the repeat command creates a new variable called "repeat" which you
1342 may access to gather information about the iteration. See the section
1343 below on `the repeat variable`_.
1341 1344
1342 **tal:replace="expression"** 1345 **tal:replace="expression"**
1343 Replace this tag with the result of the expression. For example:: 1346 Replace this tag with the result of the expression. For example::
1344 1347
1345 <span tal:replace="request/user/realname" /> 1348 <span tal:replace="request/user/realname" />
1909 templates/name/macros/macro_name 1912 templates/name/macros/macro_name
1910 1913
1911 or the python expression:: 1914 or the python expression::
1912 1915
1913 templates[name].macros[macro_name] 1916 templates[name].macros[macro_name]
1917
1918 The repeat variable
1919 ~~~~~~~~~~~~~~~~~~~
1920
1921 The repeat variable holds an entry for each active iteration. That is, if
1922 you have a ``tal:repeat="user db/users"`` command, then there will be a
1923 repeat variable entry called "user". This may be accessed as either::
1924
1925 repeat/user
1926 python:repeat['user']
1927
1928 The "user" entry has a number of methods available for information:
1929
1930 =============== =========================================================
1931 Method Description
1932 =============== =========================================================
1933 first True if the current item is the first in the sequence.
1934 last True if the current item is the last in the sequence.
1935 even True if the current item is an even item in the sequence.
1936 odd True if the current item is an odd item in the sequence.
1937 number Current position in the sequence, starting from 1.
1938 letter Current position in the sequence as a letter, a through
1939 z, then aa through zz, and so on.
1940 Letter Same as letter(), except uppercase.
1941 roman Current position in the sequence as lowercase roman
1942 numerals.
1943 Roman Same as roman(), except uppercase.
1944 =============== =========================================================
1914 1945
1915 1946
1916 The utils variable 1947 The utils variable
1917 ~~~~~~~~~~~~~~~~~~ 1948 ~~~~~~~~~~~~~~~~~~
1918 1949

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