[Zope] Re[2]: [Zope] comparing variables from different name spaces?

Ainis Ainis <ainis@mindless.com>
Tue, 28 Sep 1999 17:24:24 +0200


Hello Chris,

Well, it almost worked. I had to use <dtml-var "PARENTS[-3].id">
but now I have another problem. This variable does not exist when i
make requests in /test/ folder (which is normal, as /test/ has no
such parents), in /test/dir2 it works fine.
So I tried:
<dtml-if "PARENTS[-3].id">
but i get an error if it does not exist. So how do i check if the
variable exists?

Tuesday, Tuesday, September 28, 1999, you wrote:

CM> You can do this by using the PARENTS object.

CM> For example, the following (untested) code, when run from
CM> http://youserver/test/dir2/hardware/prices/index_html (assuming index_html
CM> is a dtml method and not a dtml document -- a dtml document has its own
CM> properties) will give you the id of the /test/dir2 folder:

CM> <!--#var "PARENTS[2].id"-->

CM> e.g. it will print "dir2"

CM> While:

CM> <!--#var "PARENTS[1].id"--> will give you the id of the hardware folder
CM> (e.g. it will print "hardware"), et. al.

CM> I think this is what you're looking for..



Best regards,
 Ainis                            mailto:ainis@mindless.com