[Zope-dev] Nesting Forms

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 19 Jul 2002 12:28:35 +0100


On Wednesday 17 Jul 2002 10:50 pm, Ross Boylan wrote:
> I have a product with a number of classes that have subclasses.  It
> seems natural to make the screens for the subclasses by extending
> those of the superclass.  Can anyone suggest a good way to do that?
>
> The naive approach is that I have a manage_edit_A.dtml that gives a
> management screen for A.  If B subclasses A, I create
> manage_edit_B.dtml by copying from the first file and then fiddling
> with it.  Obviously, it would be desirable for a change in A to only
> require changing a single file.
>
> I would prefer a more elegant approach.  Perhaps I can define some
> method in A that the dtml will reference, and then B can override the
> method to add some extra stuff

That sounds ideal.

> (the method would return a DTML
> snippet).

Do you mean dtml or html?

> First, I'm not exactly sure how to pick up the method from the DTML.

just <dtml-var my_method>

> Second, I'm not sure if this is the best solution.

I cant think of anything better

>  For one thing, I
> would prefer to keep all my dtml in separate files, rather than
> defining it into my methods.

In your example, manage_edit_A is a method defined by dtml in a seperate =
file.=20
my_method.dtml could use the same technique.=20