[Zope] Checking sequence-index using dtml-if
John Morton
John Morton <jwm@plain.co.nz>
Mon, 19 Feb 2001 18:56:24 +1300 (NZDT)
On Sun, 18 Feb 2001 21:57:27 -0600 Jeff Hotz <jeff@hotz.net> wrote:
> I only want to operate on the first 3 records returned in the=20
> ZSQL_select_images.
>=20
> I thought that a dtml-if test would do it based on the dtml-var=20
> sequence-index but I'm not having any luck.
>=20
> Any suggestions on either my logic or the implementation of it?
>=20
> Any help you can offer will be greatly appreciated. Thanks.
>=20
> <dtml-in ZSQL_select_images>
> <dtml-if expr=3D"'<dtml-var sequence-index>' < 3">
You can't embed a dtml statement inside another like this .I believe this
says 'if the string '<dtml-var sequence-index>' is less than three', which
is not what you want. What you probably did was to start by using
sequence-index and had zope complain about it. What you should try is
this:
<dtml-if expr=3D"_['sequence-index'] < 3">
Use the dtml namespace lookup notation when ever you need to use an
attribute name with a '-' in it, inside an expression. And submit it as a
bug to the collector until the DC folk give in and include '_' equivalents
to all the attributes that use dashes :-)
John