[Zope] dtml-var enhancement suggestion
James W. Howe
jwh@allencreek.com
Mon, 31 Jan 2000 14:40:01 -0500
At 02:15 PM 1/31/00 -0500, Jeff K. Hoffman wrote:
>On Mon, 31 Jan 2000, James W. Howe wrote:
>
> > I've noticed that in some of my DTML code I often times do something
> like this:
> >
> > <dtml-if foo>
> > <dtml-var foo>
> > <dtml-else>
> > Some default text
> > </dtml-if>
> >
> > I do this so that I can build a template and view it without getting key
> > errors. It would seem that a simple extension to dtml-var could make this
> > code a lot cleaner. Would it be terribly unreasonable to add a
> > "default=xxx" parameter to dtml-var? My code above could then be
> rewritten:
> >
> > <dtml-var foo default="Some default text">
>
>You aren't far off. As of 2.1.x, try:
>
> <dtml-var foo missing="Some default text">
>
>--Jeff
>
>---
>Jeff K. Hoffman 704.849.0731 x108
>Chief Technology Officer mailto:jeff@goingv.com
>Going Virtual, L.L.C. http://www.goingv.com/
Cool. As a followup, is there some way to reference another method name
from within the tag? Something like:
<dtml-var foo missing=defaultFoo>
where defaultFoo might be a DTMLMethod which contains the default
results. I've tried the syntax above and all I get is 'defaultFoo' in the
output stream.
Thanks.
James W. Howe mailto:jwh@allencreek.com
Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103