[Zope] Fw:
R. David Murray
bitz@bitdance.com
Fri, 19 May 2000 13:31:42 -0400 (EDT)
On Fri, 19 May 2000, Tom Scheidt wrote:
> > Do you know if I can limit the id to the last
> > 3 letters, rather than the first? My images have
> > _xl, _l etc. on the end.
[...]
> > <ul>
> > <dtml-in "tester.fileValues()">
> > <dtml-if "type=='image/jpeg'">
> > <dtml-if "id[0:3]=='tn_'">
> > <img src="<dtml-var "parent.id">/<dtml-var url>">
<dtml-if "id[-3:]=='_xl'">
If you take a look at the python language guide, and keep in mind
that the 'string' module is available through the '_' namespace
variable (eg: "_.string.split(somevar)"), you can do even fancier
things like find the character position of the '_' in the string
and copy out just the characters after it.
In general, you want to take a look at the Python documentation
(www.python.org) to learn how to compose complex 'if' statments.
--RDM