Sin Hang Kin wrote:
> Hello,
> I ask about how to detect root in the list and Got three answer:
> <dtml-if "_.len(PARENTS) == 1">
>   We're at the root folder
> <dtml-else>
>   You can go up from here
> </dtml-if>
> <dtml-if "title == 'Zope'">
> Title is Zope
> <dtml-else>
> No title not zope
> </dtml-if>
> <dtml-if "id == ''">
> root folder have not identity
> <dtml-else>
> there is id
> </dtml-if>
> However, all of them fail working in virtual web with siteroot set. How can
> I detect the root with or without siteroot?

perhasp you can be more specific as to what _exactly_ you need? What
do you intend to do with he information. that has a bearing on how you
get it, and what form the result is in.

Try this:
<dtml-if URL2>
  You can go up from here : <dtml-var URL0> 
  We're at the root folder: <dtml-var URL0>

This works because:
 o URL0 is the root folder 
 o URL1 is the page you are looking: at it always exists. 
 o URL2 only exists if you are in a subfolder or sub-container

If you are needing this to build a navigation system, this may or may
not work fo ryou. You can look at the breadcrumbs howto, or wait a day
or so untill a new one is posted by yours truly, using python.

If all you need is the URL of the root folder, you can use <dtml-var
Like i said, what you need it for, and how you need it determines how
to get it.

HTH, Bill

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to