[Zope] - Objects in sub-folders

Amos Latteier amos@aracnet.com
Mon, 25 Jan 1999 12:10:23 -0800


At 07:56 PM 1/25/99 +0100, Wiebe Kunst wrote:
>This is properly an enormous stupid question, but I just can't figure it
>out.

There's nothing stupid about this.

>In a folder I have another folder for images within I want to store images.
>In a document in the main folder I want to refer to images in the images
>folder. What's the DTML/HTML code for accomplishing this ?

The main important point to keep in mind when trying to figure this out is
: Zope objects are referred to by URLs. 

So let's take a hypothetical site layout:

myStuff/
  index_html
  another_doc

  myImages/
    foo.gif
    bar.gif

The URL of another_doc in the myStuff Folder is: '/myStuff/another_doc'
The URL of foo.gif in the myImages Folder in the myStuff Folder is:
'/myStuff/myImages/foo.gif'

Make sense?

So the question is, how to refer to an image within a document. The answer
is with its URL.

<img src="/myFolder/myImage/foo.gif">

That's all there is to it. You can use this snippet of HTML to refer to
your image from any Document. This is just like what you'd do when building
a filesystem based web site.

-Amos

P.S. Depending on how you have your web server configured you may need a
slightly different absolute URL, such as '/Zope/myFolder/myImage/foo.gif'.

P.P.S. You can also get Image objects to draw their own DTML tag by calling
them from within DTML, but the above method is probably easier in your case.