[Zope] Some questions for experienced zopers

Johan Carlsson johanc@torped.se
Tue, 19 Oct 1999 01:44:19 +0200


> 2.  I would like to aggregate my images into a common folder off 
> the zope root, something like this:  (indenting to show directory structure)
> / Mysite
>     [_] control_panel
>     [_] acl_users
>     [_] images
>           * img1
>           * img2
>           * img3
>     % index_html
>     % standard_error_message
>     % standard_html_header
>     % standard_html_footer
> 
> and then call them as <dtml-var images/img1> in index_html.  Even 
> though the documentation suggests that this is possible, doing so always 
> returns an error for me. any help?

You have to keep in mid your working with a server-side Object Databas.
Something are quite different to a filesystem based webserver.

First, there's two ways to access those images:

1. Modifying the namespace (namespace (and aqusition) is really 
   really confusing in the begining, but its the goodstuff that
   make Zope shine in the end.)

  If your position is in the root folder (http://server/index_html for instance)
  You can change your namespace (temporarly) to the "images" folder,
  you do this with the dtml-with tag:
  
    <dtml-with "images">
	# the namespace inside here is that of the images folder
      <dtml-var "img1.tag(your js-stuff and more")> 
    </dtml-with>
  

2. Object Referense:
   If you only need to "fetch" one item (img1) from
   the images folder you could use the following syntax:

   <dtml-var "images.img1.tag(do ya thang)">

At this point your probably preaty mad at me for showing
you the "hard" way in 1. Well it's to get you to understand
namespaces, I myself had some trouble with that in the beging... ;-)

Good luck,
Johan Carlsson