[ZPT] page layout by "including" objects

Ron Bickers rbickers-dated-997833512.01aa79@logicetc.com
Tue, 7 Aug 2001 19:58:32 -0400


In the course of using Zope and DTML, I commonly break my pages into
different objects and use <dtml-var object> to include them where desired.
I can't quite get my mind wrapped around the best way to do this using ZPT.

I started to do the following all over the place, but this doesn't seem
right.

  <div tal:replace="structure here/object">My Object Inserted Here</div>

The ZPT macros seem to fit this purpose, but so far using them is causing my
head to hurt.  Are macros indeed good for this purpose, or would another way
be better?

As an example, I have a Folder 'Quotes' with DTML documents that contain
short text quotes, and a DMTL method 'view' in that folder as follows:

  <table>
    [stuff to make pretty table]
      <td><dtml-var this></td>
    [stuff to make pretty table]
  </table>

I can then put something like the following in a DTML document
'randomquote':

  <dtml-with "_.whrandom.choice(Quotes.objectValues())">
    <dtml-var view>
  </dtml-with>

Now anytime I want to add a random quote to my page, I just use <dtml-var
randomquote>.

How would this be done cleanly in ZPT?

_______________________

Ron Bickers
Logic Etc, Inc.