I only want to operate on the first 3 records returned in the ZSQL_select_images. I thought that a dtml-if test would do it based on the dtml-var sequence-index but I'm not having any luck. Any suggestions on either my logic or the implementation of it? Any help you can offer will be greatly appreciated. Thanks. <dtml-in ZSQL_select_images> <dtml-if expr="'<dtml-var sequence-index>' < 3"> <TR> <TD ALIGN="CENTER"> <img src= "<dtml-var image_path_prop><dtml-var FILENAME>"> <BR> <FONT SIZE="4" COLOR=<dtml-var caption_color_prop>> <B><dtml-var CAPTION></B><BR><BR><BR> </FONT> </TD> </TR> </dtml-if> </dtml-in> jeff@hotz.net www.hotz.net
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 ZSQL_select_images.
I thought that a dtml-if test would do it based on the dtml-var sequence-index but I'm not having any luck.
Any suggestions on either my logic or the implementation of it?
Any help you can offer will be greatly appreciated. Thanks.
<dtml-in ZSQL_select_images> <dtml-if expr="'<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="_['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
John Morton schrieb:
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 ZSQL_select_images.
I thought that a dtml-if test would do it based on the dtml-var sequence-index but I'm not having any luck.
Any suggestions on either my logic or the implementation of it?
Any help you can offer will be greatly appreciated. Thanks.
<dtml-in ZSQL_select_images> <dtml-if expr="'<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="_['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 :-)
Patch is available from me until DC follows... Regards Tino
On Monday 19 February 2001 16:56, John Morton wrote:
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 ZSQL_select_images.
I thought that a dtml-if test would do it based on the dtml-var sequence-index but I'm not having any luck.
Any suggestions on either my logic or the implementation of it?
Any help you can offer will be greatly appreciated. Thanks.
<dtml-in ZSQL_select_images> <dtml-if expr="'<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="_['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 :-)
Whilst this is a good answer in that it corrects a misunderstanding in the users understanding of DTML, there is, imho, a better solution to the actual problem. And that is to slice the returned list from the ZSQL method.... something like: <dtml-in expr="ZSQL_select_images()[:3]"> ... </dtml-in> will only iterate over the first 3 elements in the list.
John
participants (4)
-
Curtis Maloney -
Jeff Hotz -
John Morton -
Tino Wildenhain