Newbie <dtml-if> question
I have the following statement: <dtml-if "'<dtml-var id>.jpg' in somelist"> DoSomething </dtml-if> id is some arbitrary numeric value that will change. Is the If tag being resolved to: <dtml-if "'1.jpg' in somelist"> or <dtml-if "<dtml-var id>.jpg in somelist"> Thanks Stuart Foster MediServe Information Systems
Stuart Foster wrote:
I have the following statement:
<dtml-if "'<dtml-var id>.jpg' in somelist"> DoSomething </dtml-if>
id is some arbitrary numeric value that will change.
Is the If tag being resolved to: <dtml-if "'1.jpg' in somelist"> or <dtml-if "<dtml-var id>.jpg in somelist">
The second one. You can't have dtml inside dtml. Instead, what you need to do is this: <dtml-if "id + '.jpg' in somelist"> Actually... if id is numeric then you need to do: <dtml-if "_.str(id) + '.jpg' in somelist"> -- Nick Garcia | ngarcia@codeit.com CodeIt Computing | http://codeit.com
Use <dtml-if "picture"> do someting<br> </dtml-if> That doesn´t work because you handle with objekts and not with files. S ".jpg"is only the id of the object and cannot be devided in that way. The typ of the fobject is set by the content property and depends on the object. you can name your image object with only a arbitrary numeric like "234" or "1" or something like this <dtml-if "'<dtml-var id>.jpg' in somelist"> Use this if you want to list all images in your directory. <dtml-in "objectItems('Image')" sort=id> <dtml-var sequence-item> </dtml-in> ----- Original Message ----- From: Stuart Foster <stuartf@MediServe.com> To: <zope@zope.org> Sent: Donnerstag, 6. April 2000 20:30 Subject: [Zope] Newbie <dtml-if> question
I have the following statement:
<dtml-if "'<dtml-var id>.jpg' in somelist"> DoSomething </dtml-if>
id is some arbitrary numeric value that will change.
Is the If tag being resolved to: <dtml-if "'1.jpg' in somelist"> or <dtml-if "<dtml-var id>.jpg in somelist">
Thanks
Stuart Foster MediServe Information Systems
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
you would have to use something like <dtml-if "id in somelist"> where id would contain the jpg part. if the id contains a point this should be (indirect lookup) <dtml-if "_['id.jpg'] in somelist"> because the point is special to zope. On Thu, 6 Apr 2000, Stuart Foster wrote: :I have the following statement: : :<dtml-if "'<dtml-var id>.jpg' in somelist"> : DoSomething :</dtml-if> : :id is some arbitrary numeric value that will change. : :Is the If tag being resolved to: <dtml-if "'1.jpg' in somelist"> :or <dtml-if "<dtml-var id>.jpg in somelist"> : : :Thanks : :Stuart Foster -- _________________________________________________ peter sabaini, mailto: sabaini@niil.at -------------------------------------------------
Your statement resolves to: <dtml-if "<dtml-var id>.jpg in somelist"> To resolve to: <dtml-if "'1.jpg' in somelist"> try: <dtml-if "_.str(id) + '.jpg' in somelist"> -----Mensaje original----- De: zope-admin@zope.org [mailto:zope-admin@zope.org]En nombre de Stuart Foster Enviado el: jueves, 06 de abril de 2000 20:30 Para: 'zope@zope.org' Asunto: [Zope] Newbie <dtml-if> question I have the following statement: <dtml-if "'<dtml-var id>.jpg' in somelist"> DoSomething </dtml-if> id is some arbitrary numeric value that will change. Is the If tag being resolved to: <dtml-if "'1.jpg' in somelist"> or <dtml-if "<dtml-var id>.jpg in somelist"> Thanks Stuart Foster MediServe Information Systems
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Stuart Foster wrote:
I have the following statement:
<dtml-if "'<dtml-var id>.jpg' in somelist"> DoSomething </dtml-if>
*snip* Someone has to mention there is an other potential error: id is probably the id of the current folder/document. So to be on the safe side, try to use an other variable. You might also want to use: <dtml-if "somelist.has_key(_.str(id_var)+'.jpg')"> ... </dtml-if> if "somelist" is a folderish object. HTH Tino Wildenhain
participants (6)
-
jensebaer -
Juan Carlos Coruña -
Nick Garcia -
Peter Sabaini -
Stuart Foster -
Tino Wildenhain