[Zope] dtml-var enhancement suggestion

Jeff K. Hoffman jeff@goingv.com
Mon, 31 Jan 2000 14:15:31 -0500 (EST)


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/