[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Using Zope Page Templates

webmaster at zope.org webmaster at zope.org
Sun Feb 1 04:54:26 EST 2004


A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ZPT.stx#2-86

---------------

    Create a new Page Template called "entries.xml" in your guest book
    folder with the following contents::

      <guestbook xmlns:tal="http://xml.zope.org/namespaces/tal">
        <entry tal:repeat="entry python:here.objectValues('DTML Document')">
          <comments tal:content="entry/document_src">Comment goes here...</comments>
        </entry>
      </guestbook>

      % snell - Dec. 11, 2003 8:10 am:
       Is this section on Page Templates and TAL?
       Note: objectValues('DTML Document'). Replace that with objectValues('Page Templates') as by rights one
       should, and you get a very different result. And who knows how to clean it up?

      % ExileJedi - Jan. 18, 2004 4:45 pm:
       If you want to build the XML from a collection of DTML documents, then you'd still want to use
       here.objectValues('DTML Document') to match all the DTML documents in the directory. To build the XML from a
       collection of page templates, I believe you'd use objectValues('Page Template').
       All this example does is take all of the Zope objects of the specified type and jam their source into the
       space between each <comments> and </comments>. If any of what you are jamming into the XML document contains
       data that looks like an HTML tag, it will be properly quoted (turning the less-thans and greater-thans into
       their respective HTML character entities). This can make the resulting XML document look ugly if you just
       view it in your browser, but if you view the resulting document source, you'll see that it is "clean."
       Ideally, for a simple example like this, you'd want to use a bunch of files that aren't marked up with
       various tags, so as to minimize confusion.
       Also, you may be reading more significance into what's meant to be a really basic example of the fact that
       you can make XML documents just as easily as you can make HTML documents. It's just showing how to take some
       simple data and jam it into a structure of your design.

      % Anonymous User - Feb. 1, 2004 4:54 am:
       Kill Snell!



More information about the ZDP mailing list