Inserting variables into expressions
I want to insert an image tag into a page from a given folder: <dtml-var "aFolder.anImage.tag(border=0, align='right')"> Rather than this inserting 'anImage' I would like to be able to insert a variable name in the place of 'anImage' so it will instead place an image defined by the request. I've tried a number of variants on the following syntax with no success: <dtml-var "aFolder._.getitem('aVariable').tag(border=0, align='right')"> Can anyone point me in the right direction? thanks, Roger. _____________________ Roger Sillito Web Assistant Publications & Website Development Office 6 Kensington Terrace University of Newcastle upon Tyne NE1 7RU Tel: 0191 222 3482 http://naoyam.ncl.ac.uk/ e-mail: w.r.sillito@ncl.ac.uk
On Thu, Sep 06, 2001 at 12:11:50PM +0100, Roger Sillito wrote: Roger> <dtml-var "aFolder._.getitem('aVariable').tag(border=0, align='right')"> My brain hurted trying to count number of mistakes you did. Do you understand all that _. and getitem? Well, try this (untested): <dtml-var "aFolder[aVariable].tag(border=0, align='right')"> Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Oleg Broytmann -
Roger Sillito