[Zope] This document's folder's URL?

Michel Pelletier michel@digicool.com
Mon, 17 Apr 2000 21:48:49 -0700


Nolan Darilek wrote:
> 
> >>>>> "Chris" == Chris McDonough <chrism@digicool.com> writes:
> 
>     Chris> Nolan, Perhaps something like:
> 
> <snip>
> 
> This works nicely, with one minor gotcha: it seems that the item on
> which &dtml-absolute_url; appears needs to be a DTML
> document. Otherwise, it seems to point to the method's ID concatenated
> onto the current absolute URL.

you lost me.  absolute_url() in a method will render the URL to the
folder that contains the method.  absolute_url in a document will render
the absolute url of the document.
 
> And, one partially non-Zope question: currently, to link to my main
> website from a subfolder, I have a URL which looks like:
> 
> <a href="http://www.mysite.com/nolan/folder/menu/../../">Home</a>
> 
> First, is this legal HTML,

yes.

> or will browsers barf on this? And, is it
> somehow possible to treat &dtml-absolute_url; as a list of objects to
> do something like (pseudopython):
> 
> <dtml-var
> "string.join(&dtml-absolute_url;[:len(&dtml-absolute_url;)-2])">

There is a list of objects from you to the root folder called PARENTS. 
'You' are PARENTS[0], your parent is PARENTS[1], your grandparent is
PARENTS[2], and the root folder is PARENTS[-1] (the last element in the
list).

<a href="<dtml-var "PARENTS[-1].absolute_url()">">This link goes to the
root folder.</a>

Also, there is URLx.  URL is your URL.  URL1 is the URL of your parent. 
URL2 is the URL of your grandparent and so on.

<a href="<dtml-var URL1>">Click to go up one parent.</a>

-Michel