[ZPT] referencing items in lists
Chui G. Tey
chui.tey@advdata.com.au
Fri, 2 Nov 2001 16:58:05 +1000
This is a multi-part message in MIME format.
------_=_NextPart_001_01C1636B.B87ED910
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This ought to be simple:
=20
I'm trying to do this:
=20
<span tal:define=3D"mybookmarks python:('zope.org', 'Zope'),
('python.org', 'Python')"
>
<a tal:repeat=3D"bookmark mybookmarks"
href=3D"dummy" span tal:attributes=3D"python: bookmark[0]"
tal:content=3D"bookmark[1]">
Dummy link
</a>
</span>
To produce this:
=20
<a href=3D"zope.org">Zope</a>
<a href=3D"python.org">Python</a>
=20
But PageTemplates complain:
=20
<!-- Page Template Diagnostics
Compilation failed
Products.PageTemplates.TALES.CompilerError: Invalid variable name
"bookmark[0]"
-->
=20
How do I access the items of an Iterator in this case?
=20
Chui
------_=_NextPart_001_01C1636B.B87ED910
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial size=3D2>This =
ought to be=20
simple:</FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial size=3D2>I'm =
trying to do=20
this:</FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial =
size=3D2> =20
<span tal:define=3D"mybookmarks python:('zope.org', 'Zope'),=20
('python.org',=20
'Python')"<BR> =20
><BR> <a tal:repeat=3D"bookmark=20
mybookmarks"<BR> =
href=3D"dummy"=20
span tal:attributes=3D"python: bookmark[0]"=20
tal:content=3D"bookmark[1]"><BR> =
Dummy=20
link<BR> </a><BR> =20
</span><BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial size=3D2>To =
produce=20
this:</FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial =
size=3D2> <a=20
href=3D"zope.org">Zope</a></FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial =
size=3D2> <a=20
href=3D"python.org">Python</a></FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial size=3D2>But =
PageTemplates=20
complain:</FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial =
size=3D2><!-- Page=20
Template Diagnostics<BR> Compilation=20
failed<BR> Products.PageTemplates.TALES.CompilerError: Invalid =
variable=20
name "bookmark[0]"<BR>--></FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial size=3D2>How do =
I access the=20
items of an Iterator in this case?</FONT></SPAN></DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D417095106-02112001><FONT face=3DArial=20
size=3D2>Chui</FONT></SPAN></DIV></BODY></HTML>
------_=_NextPart_001_01C1636B.B87ED910--