[Zope-CMF] Rendering referenced object

Tres Seaver tseaver@zope.com
03 May 2002 11:44:14 -0400


On Fri, 2002-05-03 at 04:23, J C Lawrence wrote:
> 
> I'm working on a CMFTopic derivative and would like it to render (some
> of) the found objects and not just list their titles.  Is there a
> canonical way under CMF to poke an object (preferably by URL) and get
> its rendered form back as a string/DTML-var or some such?

There is currently no "standard" way of asking a content object to
render itself as a "page element."  One way to implement this notion is
to add an "invisible" action to each type information object (e.g.,
called "slot_view");  define it to call the right method on each type
(e.g., 'CookedBody' for Document-derived types, 'tag' for Image, etc.)
Then use that action as an indirection in your presentation, e.g.
(untested)::

  <!-- blog_items contains the list of objects (*not* brains) -->
  <dtml-in blog_items>
    <dtml-let obj_type="getTypeInfo()"
              slot_view_name="obj_type.getActionById( 'slot_view' )">
      <dtml-var expr="_[ slot_view_name ]">
    </dtml-let>
  <dtml-in>

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com