Re: [Zope] #include with DocumentTemplate?
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 URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html ? "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). Dieter
Dieter Maurer wrote:
Apparently, you look at the wrong documentation.
Perhaps I did. Or maybe I just didn't understand it properly.
Did you look at the Zope book or the DTML section of URL:http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
I hadn't and I'm sure that's part of the problem. As I said, I'm not really using Zope, I just borrowed DocumentTemplate from it to use with my Python CGIs. I had thought about using Zope for this project I'm working on, but decided on trying just Python, since I thought that learning Zope in addition to learning Python would take too much time. So, I don't have any Zope books at the moment. It's very helpful to see your version of Zope documentation and examples. Is your online book finished? It looks like parts (the introduction) are missing. -- Lance E Sloan Web Services, Univ. of Michigan: Full-service Web and database design, development, and hosting. Specializing in Perl & Python CGIs. http://websvcs.itd.umich.edu/ - "Putting U on the Web"
participants (2)
-
Dieter Maurer -
Lance E Sloan