Sorry to keep bothering everyone with my numerous questions. Here's the latest... Given a URL like this: http://servername/Projects/ProjectName/Path/To/Document I can use <dtml-var "_.string.split(URL0,'/')[4]"> to get the name of the project. However, on pages in the ProjectName folder, I am using a tree to show the docs available. If my tree tag is: <dtml-tree expr="ProjectName" ... everything works. I want this code to work for multiple projects however so I tried: <dtml-tree expr="_.string.split(URL0,'/')[4]" ... but this doesn't seem to actually evaluate the method call as I got a name error for _. How can I have the dtml-tree tag evaluate that expression and get 'ProjectName'? Thanks again. -- Guy Davis mailto:davis@arc.ab.ca (403) 210-5334 Alberta Research Council
Guy Davis wrote:
<dtml-tree expr="_.string.split(URL0,'/')[4]" ... but this doesn't seem to actually evaluate the method call as I got a name error for _. How can I have the dtml-tree tag evaluate that expression and get 'ProjectName'? Thanks again.
Well, you should be able to do <dtml-tree expr="_[_.string.split(URL0,'/')[4]]">, but that's a bit roundabout when what you probably want is <dtml-tree expr="PARENTS[-3]"> (that is, the third parent object from the top, counting the root). Cheers, Evan @ 4-am
participants (2)
-
Evan Simpson -
Guy Davis