[Zope] Yet another way to insert a variable from an expression
DA Loeffler
David.Loeffler@bristol.ac.uk
Mon, 15 Jul 2002 09:24:56 +0100 (BST)
Sorry, the "missing" attribute doesn't work, but you can always just
wrap it in a <dtml-try> block that will catch the error and not do
anything with it, like
<dtml-try>
<dtml-var expr=3D"_[id()+'.gif']">
<dtml-except>
</dtml-try>
It's a bit of a kludge but it works.
On Fri, 12 Jul 2002, Jaroslav Lukesh wrote:
> | Odes=EDlatel: DA Loeffler <David.Loeffler@bristol.ac.uk>
> |=20
> | <dtml-var expr=3D"_[id()+'.gif']" missing>
>=20
> | <dtml-var "_.getattr(this().aq_parent, id() + '.gif')">
>=20
> Genius! It works both, maybe complicated one will work better (restricted
> acquisition), but...
>=20
> | > > file1
> | > > file1.gif
> | > > file2
> | > > file3
> | > > file3.gif
>=20
> But it does have error when filename does not have image filename.gif, li=
ke
> file2
>=20
> I was try dtml-if, dtml-let+dtml-if (and nested dtml-in - it does not wor=
k
> because one is ObjectValue"DTML Document" and second is
> ObjectValue"Image").
>=20
> <dtml-if "_.string.find(_.getattr(this().aq_parent, id() + '.gif'),
> '.gif')>0">
>=20
> In attachment is a small file with my some tryouts (sorry, You do not an
> idiot, but me :)
>=20
> Many thanks
>=20
> Jaroslav Lukesh
>=20
>=20