[Zope] images

Jason Cunliffe jasonic@nomadicsltd.com
Sun, 6 May 2001 22:14:09 -0400


"Joe Copeland" <joe@LADWP.net> wrote:
> How can I place an images in an "/images" folder so that they can be
> acquired by my entire site.
>
> I've placed my images in a directory called  "/images"  but I can't use
the
> <dtml-var image.gif> tag to access the image unless I'm in the /images
> directory or beneth it.
>
> Is there a way I can set the source directory of all image objects so that
> whenever I call upon an image by the image name Zope can find it?

...yeah funky ain't it?
This is probably #1 ZopeNewbie FAQ.
Here's what you have to do:

<dtml-with images>
  <dtml-var nameofimage>
</dtml-with>

<dtml-with images> means something like "with the namespace of images" do
whatever in there until I exit using</dtml-with>
You can nest them and do all sorts of neat powerful tricks with <dtml-with>
For a _real_ explanation read up on <dtml-with> in the book and elsewhere on
Zope.org

A pretty good one is :
http://www.zope.org/Members/michel/HowTos/NameSpaceHow-To

Suppose you have a subfolder called "theatre" inside /images. Then you can
do this:

<dtml-with "images.theatre">  # note: the quotes are important
  <dtml-var nameofimage>
</dtml-with>

This syntax still seems counterintuitive and verbose to me, even when I know
why and grown familiar with it. Some might even consider it a ZopeDTML
annoyance. Best to make friends though, and/or  master the syntax for
programming Zope using External Python Methods and/or Scripts (Python).
Every tool in zope has its virtues ancd vices. The hard part is learning
what those are, for you and your project.

Look through How-Tos for "Image" and you'll find some useful DTML examples
to copy and also design advice about images in Zope.

If you have multiple folders of the same id name [such as "images"]
scattered aournd your Zopesite, and you are getting headaches because
<dtml-with> does not work the way you expect, then it is time to read up
[again] on namespace and the 'only' tag atribute of <dtml-with> .

hth
./Jason

___________________________________________________________
Jason CUNLIFFE = NOMADICS['Interactive Art and Technology']