[Zope] String to object ID

Goodrichs nbd95@macconnect.com
Mon, 6 Dec 1999 01:40:07 -0500


Well I still don't know how to reference a Zope object from a string, but I
have a interim solution for now.

I created a method in my root directory called "buildHeader";

<dtml-let newname="(
	_['root']+'/'+
	_['prefix']+'/'+
	_['path']+
	_['fold'])">
	<IMG SRC="<dtml-var newname>">
</dtml-let>

Then in _any_ document within the site I can add the following code;

<dtml-var "buildHeader(
	root=REQUEST.BASE0,  <-- urlbase of my website(works with site access!)
	fold=PARENTS[0].id,  <-- id of parent directory
	path='images',   <-- path to my images folder
	prefix='hd')">  <-- prefix identifier of image

The correct image is displayed based on the directory location of the
document. It's not much but it's a start on what we are looking for. I
still.....   don't understand why I cannot create a Zope reference on the
fly. It seems strange to me that object references must be hardwired into
Zope. That I can see,  if you do not already have the object within your
namespace, it is inaccessible.

Possibly I do not see this correctly, must every object link within a Zope
website be hardcoded?

Thanks,

DAve.