[ZPT] 'root' in virtual hosts

Evan Simpson evan@zope.com
Fri, 21 Sep 2001 16:03:03 -0400


Ron Bickers wrote:

> When I use a path with root (eg, tal:replace="root/myObject") from a site
> that is hosted using a VHM setup, "root" means the root of the Zope tree,
> not the root of the virtual hosted site.


This is because Zope has a very weak notion of virtual hosts, pretty much 
confined to the VHM.  One approach would be to place a Script like this in 
the site root:

## Script (Python) "getSiteRoot"
##bind container=container
##parameters=
##title=
##
return container


Then you could write "here/getSiteRoot", or put a 


tal:define="global vhroot here/getSiteRoot"


...at the top of your templates.

Cheers,

Evan @ Zope