[Zope] Using "global" images in /root/subfolder

Rik Hoekstra hoekstra@fsw.LeidenUniv.nl
Tue, 19 Oct 1999 09:24:16 +0200


> Let's assume the following structure of a site
>
>   /root
>      /global_images
>         mail_png
>         link_png
>
>      /content
>         some_content  (DTML document)
>
> In some_content, I would like to use something to the effect of
>
>   <dtml-var mail_png>
>
> to take advantage of the image "mapping" provided by Zope. But how can I
> address mail_png?
>
> The goal is to address a few global images from any location on the site
> with the least amount of work possible. I am as far as
>
>   <dtml-var globalImage>
>
> in "some_content". "globalImage" is a DTML document in /root that contains
>
>   <dtml-var graphics.mail_png>
>
> to directly access the image. For the less interesting parts
>
> <dtml-var "graphics.mail_png">
>
> <dtml-with "graphics">
>   <dtml-var "mail_png">
> </dtml-with>
>
>
> <dtml-with "graphics">
>   <dtml-with "_.namespace(AName='mail_png')">
>     <dtml-var "mail_png">
>   </dtml-with>
> </dtml-with>
>
> <dtml-with "graphics">
>   <dtml-with "_.namespace(AName='mail_png')">
>     <dtml-var "_['AName']">
>   </dtml-with>
> </dtml-with>
>
> works, but unfortunately,
>
>     <dtml-var "_['AName']">
>
> emits "mail_png" as the *text*, not the image. IOW, I am stuck.
> Oh, I have no clue how to pass a parameter to the DTML document, so that I
> can say
>
>   <dtml-var name="globalImage(AName='mail_png')">
>   <dtml-var name="globalImage(AName='link_png')">
>
> or whatever works.

try:

<dtml-var "_.getitem(AName)">

Use _.getitem(var) if you want an unrendered variable.
See http://www.zope.org/Documentation/How-To/AdvancedDTML for a more
detailed explanation.


Rik