[Zope] Boolean
Ross J. Reedstrom
reedstrm@rice.edu
Tue, 04 May 1999 18:18:52 -0500
Jason Spisak wrote:
>
> Zopsters:
>
> After reading again for a boolean info the DTML docs, I can't seem to
> see the best route to test in DTML.
> I tried a simple <!--#if "foo is true"-->, didn't work
>
> I thought, since bolean deal with 1 and 0, I'd use
> <!--#if "foo==1"--> for true and
> <!--#if "foo==0"--> for false. That didn't work either.
>
> If I however used blank or '' as the search criteria it worked, as in
> <!--#if "foo==''"--> for true, and nothing for false.
>
> Whats going on with boolean, and can somebody point in the right
> direction?
>
Hmm, did you try:
<!--#if foo-->
tests for _existence_ of the property foo, and
<!--#if "foo"-->
tests the value of foo.
so:
<!--#if foo-->
yep
<!--#else-->
nope
<!--/if-->
works regardless, but if you put in the quotes, you'll throw an error if
foo doesn't exist.
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005