[Zope] [ZGotW] Issue #1 (Open)
Zope Guru of the Week
ZGotW@palladion.com
2000/01/20 14:37:3.56875 US/Pacific
A new issue of "Zope Guru of the Week" is available:
===================================================================
Issue #1 -- DTML Subroutines
===================================================================
Status: Open
Zen Level: Novice (1/8)
Keywords: DTML
Submitted by: Tres Seaver tseaver@palladion.com
-------------------------------------------------------------------
Suppose you have been happily hacking away at your Zope site,
and discover that you are reusing a chunk of DTML over
and over::
<!-- Display all contained FooTypes in a table-->
<dtml-in "objectValues( 'FooType' )">
<tr>
<td> <a href="&dtml-id;"><dtml-var id></a> </td>
<!-- more FooType properties follow -->
</tr>
</dtml-in>
Now, you decide to "refactor" the site to follow the
"Once and Only Once":http://c2.com/cgi/wiki?OnceAndOnlyOnce dictum of
"Extreme Programming":http://www.extremeprogramming.org :
i.e., you'd like to make this snippet a reusable "subroutine,"
so that you could make changes to it in just one place.
How do you move this code out into a DTML Method and then
replace all the cloned copies with calls to that method?
-------------------------------------------------------------------
To reply and win undying glory and mondo guru points:
http://209.67.167.7/demos/ZGotW/1