I modified it like so: <dtml-if "_.fmod(_['sequence-index'],10)==0"> </tr> <tr><td><dtml-var sequence-item></td> <dtml-else> <td><dtml-var sequence-item></td> </dtml-if> Now i get: Error Type: AttributeError Error value: fmod i'm lost. is this the right approach or is there another way? roché
I want to create a list of image thumbnails in a table. On every tenth item i want to start a new row. I thought the "fmod" function is appropriate. I get a syntax error however.
My DTML:
<dtml-in "PARENTS[0].objectItems('Image')"> <dtml-if sequence-start> <table><tr> </dtml-if> <dtml-if "_.fmod(_.['sequence-index'],10)=0">
shouldn't that be "==0"?
----- Original Message ----- From: "RC Compaan" <roche@up-front.co.za> To: "Zope" <zope@zope.org> Cc: "Kevin Dangoor" <kid@kendermedia.com>; <jsanford@atinudeus.com>; <tseaver@palladion.com> Sent: Tuesday, February 15, 2000 11:25 AM Subject: RE: [Zope] Namespace + syntax question
I modified it like so: <dtml-if "_.fmod(_['sequence-index'],10)==0"> </tr> <tr><td><dtml-var sequence-item></td> <dtml-else> <td><dtml-var sequence-item></td> </dtml-if>
Now i get: Error Type: AttributeError Error value: fmod
i'm lost. is this the right approach or is there another way?
fmod is actually in the math module, so you need to do: <dtml-if "_.math.fmod(_['sequence-index'],10)==0"> I think this method should work. Kevin
RC Compaan wrote:
I modified it like so: <dtml-if "_.fmod(_['sequence-index'],10)==0"> </tr> <tr><td><dtml-var sequence-item></td> <dtml-else> <td><dtml-var sequence-item></td> </dtml-if>
Now i get: Error Type: AttributeError Error value: fmod
Ooops, fmod lives the math module:: <p>fmod( 42, 13 ) is <dtml-var "_.math.fmod( 42, 13 )"></p> works for me (note that it returns a floating point number. The integer modulo operator is what you seem to need:: <p> 42 % 13 is <dtml-var "42 % 13"></p> Tres. -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
participants (3)
-
Kevin Dangoor -
RC Compaan -
Tres Seaver