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? Rgs, Kent Sin --------------------------------- kentsin.weblogs.com kentsin.imeme.net
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> <dtml-else> We're at the root folder: <dtml-var URL0> </dtml-if> 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 URL0> Like i said, what you need it for, and how you need it determines how to get it. HTH, Bill
Bill Anderson wrote:
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> <dtml-else> We're at the root folder: <dtml-var URL0> </dtml-if>
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
Oops, reverse that. I wrote them backwards, and realized it immediatly after hitting 'send'. The root folder is the highest x in URLx, you start from where you are (URL0), and count up. URL2 still only exists if are in at least one level below the root, though. If you are in the root fodler, URL0 wil be the page you are on, and URL1 will be the root. URL1 will always exist in DTML (AFICT). YMMV.
----- Original Message ----- From: Sin Hang Kin <kentsin@poboxes.com>
How can I detect the root with or without siteroot?
<dtml-in PARENTS> <dtml-if expr="absolute_url(relative=1) == ''"> <dtml-var objectIds> </dtml-if> </dtml-in> Will show you the contents of both the site "root" and the ZODB root folder, if the Path of your SiteRoot is '/'. Cheers, Evan @ digicool & 4-am
YES!! Greate! Thank you Evan! Rgs, Kent Sin ---------------------------------------------- Do we need long term solution in web? --- Original Message ----- From: "Evan Simpson" <evan@4-am.com> To: "Sin Hang Kin" <kentsin@poboxes.com>; "Zope Admin list" <zope@zope.org> Sent: Monday, May 22, 2000 12:31 AM Subject: Re: [Zope] detect root.
----- Original Message ----- From: Sin Hang Kin <kentsin@poboxes.com>
How can I detect the root with or without siteroot?
<dtml-in PARENTS> <dtml-if expr="absolute_url(relative=1) == ''"> <dtml-var objectIds> </dtml-if> </dtml-in>
Will show you the contents of both the site "root" and the ZODB root folder, if the Path of your SiteRoot is '/'.
Cheers,
Evan @ digicool & 4-am
participants (3)
-
Bill Anderson -
Evan Simpson -
Sin Hang Kin