dtml-var enhancement suggestion
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"> Comments welcome. James W. Howe mailto:jwh@allencreek.com Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html Ann Arbor, MI 48103
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/
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
On Mon, 31 Jan 2000, James W. Howe wrote:
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.
As far as I can tell, this is not possible. Of course, I've been wrong before. :) --Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
"James W. Howe" wrote:
Would it be terribly unreasonable to add a "default=xxx" parameter to dtml-var?
Ever heard of Guido's time machine? I'm borrowing it :-) Go ahead and try (if you're at 2.1.1 or better): <dtml-var undefined_thing missing="I don't exist"> There should also soon be a "default" parameter which acts a lot like "missing" except it affects existing variables which have the value None as well as undefined variables. Cheers, Evan @ 4-am (and soon digicool)
participants (3)
-
Evan Simpson -
James W. Howe -
Jeff K. Hoffman