[Zope] Sharing images between different sites

Paul Winkler pw_lists at slinkp.com
Wed Nov 17 20:41:59 EST 2004


On Wed, Nov 17, 2004 at 11:16:14PM +0100, Tino Wildenhain wrote:
> Hi,
> 
> Am Mittwoch, den 17.11.2004, 20:52 +0000 schrieb John Poltorak:
> > Is there any way to set up an images folder which can be shared between 
> > several sites under one zope instance?
> > 
> > If so how would I reference them if they were all in the /images folder?
> 
> Of course. And you reference them by context.images.whateverimage
> or in HTML: <img src="/images/whateverimage">
> 
> You should always specify a path starting with / in Zope links.
> it does not matter if the site is somewhere down the path,
> aquision solves it (as long as there is no other images object
> in the path to root)

But this breaks when you use virtual hosting.
I try to always do one of the following:

a) give a relative path and let acquisition deal with it...
e.g. <img src="images/whateverimage" />

or (preferred)

b) call a method that gives a good result in all circumstances,
e.g.
<img tal:replace="here/images/whateverimage" />
or
<img tal:attributes="href here/images/whateverimage/absolute_url" />
or
<img tal:attributes="href here/images/whateverimage/absolute_url_path" />

etc.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list