[Zope] Fw: Embeding docs with dtml

R. David Murray R. David Murray" <bitz@bitdance.com
Sun, 9 Apr 2000 15:45:58 -0400 (EDT)


On Thu, 6 Apr 2000, Carlos Neves wrote:
> Hi, i'm trying to embed a dtml document in a child folder with a dtml
> method, like this:
>     - I have a class wich defines the property "DocBase"
>     - I have a dtml document called "DocTest1" in folder "Docs"
>     - I set the "DocBase" to "Docs.DocTest1"
> 
>     Now, I need to call the contents of the document pointed by "DocBase"
> from a method. No hardcoding besides the name of the class and the name of
> the property... Several aproaches have been tried, with no luck :(

I'm not sure I'm entirely understanding the problem you are trying to
solve, but I just tested the code below and perhaps it will at least
point you in a useful direction.  My test setup is a folder named
'testfolder' within which is a dtml document named 'testdoc'.  The
parent folder has a dtml method named 'test' containing the code
below, and a property named 'testprop' containing the string
'testfolder.testdoc'.  I think this code should work no mater where
the dtml-method and the property are located, ie: they should work
if defined on a class, but I haven't tested that.

Here's the code:

<dtml-call "REQUEST.set('o',PARENTS[-1])">
<dtml-in "_.string.split(testprop,'.')">
  <dtml-call "REQUEST.set('o',o[_['sequence-item']])">
</dtml-in>
<dtml-var o>

When I call this method, I see the rendered contents of my 'testdoc'.
Note that this code assumes testprop contains a complete path
sequence from the root folder (PARENTS[-1]).

--RDM