[Zope] DTML Container?
Steve Spicklemire
steve@spvi.com
Tue, 8 Feb 2000 06:28:38 -0500 (EST)
Hi Mike,
Hmmm.. how about just letting each instance of your
ObjectManagerish ZClass contain a "DTML Method" called
story_dtml or something. Then the index_html method of
the Zclass could (among other things possibly..) call
<dtml-var story_dtml>
which can then us all the tags your're talking about freely?
more soon I'm sure... ;-)
-steve
>>>>> "Mike" == Mike <mike@if-site.com> writes:
Mike> Hello,
Mike> I wondered what is the simples (and efficient) way of
Mike> implementing subj.
Mike> Let I explain first what it may be needed for.
Mike> Suppose we'd like to create a class modeling an article
Mike> (newspaper article, for example). An article has attributes
Mike> 'title' and 'body' and can contain zero or more
Mike> photos. Article's body contains some HTML text exposing
Mike> those photos, if any. Note the images are aggregated by
Mike> article and should not be exposed anywhere else.
Mike> The simplest way is to subclass our Article from
Mike> (Z)ObjectManager and implement title and body as
Mike> properties. On this way we are losing the DTML capabilities
Mike> which we were have in DTML document/method. This is a big
Mike> lost, indeed (at least we have to write <img src=img
Mike> width=... height=... alt=...> instead of just <dtml-var
Mike> img>). The one way to keep object DTML-aware is to subclass
Mike> DTML method also. I tryed this approach and found this
Mike> working, but with one exception: <dtml-var img> does not
Mike> work. It does not work on _any_ callable objects. The
Mike> workaround is <dtml-var "img.tag()"> or something
Mike> equivalent. This is also not so good.