[Zope] RE: Soft References in DTML

Dr. Ross Lazarus rossl@med.usyd.edu.au
Wed, 10 May 2000 22:05:58 +1000


<dtml-with "_.getitem(stringvaluetodereference)"><dtml-var
absolute_url></dtml-with>

Tested before posting.


> From: John Morton  <jwm@p...>  
> Date: Wed May 10, 2000 8:44am  
> Subject: [Zope] Soft References in DTML  
> 
> 
> 
> I'm constantly running into this general problem in DTML - how do I access
> an object or property who's name is given in a string?
> 
> Here's a specific problem: 
> 
> I've got a Zclass product that has a string property in a sheet that's
> supposed to hold the name of the prefered cascading style sheet used when
> rendering the object. The name is automatically added to the header of the
> html doc when rendered, like this:
> 
> <link href="<dtml-var style_sheet>" ...>
> 
> But the style sheet itself lives a few directories down from the document
> being rendered so I really want the absolute URL. If I could act the
> object I could do <dtml-var "css_object.absolute_url()"> - but the name
> css_object (or whatever) is the value of the string style_sheet. 
> 
> So how can I dereference the string?
> 
-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 126A, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: rossl@med.usyd.edu.au