[Zope] #include with DocumentTemplate?

Dieter Maurer dieter@handshake.de
Fri, 4 May 2001 19:51:30 +0200 (CEST)

Lance E Sloan writes:
 > I'm writing some CGIs in Python and I borrowed the DocumentTemplate
 > module from Zope because it does most of what I need.  However, there's
 > one thing that it apparently doesn't do that I would really like.  And
 > that would be to use "#include" tags to read in other DTML documents
 > and parse them.  That is, tags like this:
 > 	<!--#include name="header.dtml" -->
 > Does DocumentTemplate already handle that?  I couldn't find it in the
 > documentation.
Apparently, you look at the wrong documentation.

Did you look at the Zope book or the DTML section of



"dtml-var" can include any object: attributes, property values,
functions and methods without arguments (they are called before
inclusion), DTML objects (they are called with parameters
'None' and the current DTML namespace), Scripts (they
are called with the DTML namespace and possible further parameters
from the environment, if configured).

Usually, DTML objects must already be objects and
not file names. Thus, you should already have transformed
your files into DTML objects (there are special classes
for that), and put them in the DTML namespace
(passing either a mapping or keyword arguments to your
top level DTML object call).