The Toolkit for Online Communities
16692 Community Members, 1 member online, 2319 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Is there a right way to deal with booleans? : One Message

Forum OpenACS Development: Response to Is there a right way to deal with booleans?

Posted by Tilmann Singer on
<code>&lt;if @bool_p@ true&gt;</code> is quite a useful function, thanks! This should definitely go as an example for usage of &lt;if ... &gt; into the templating documentation. The original toolkit developers must have missed this too - grepping for "@ true" and "@ false" yields no results except in the acs-templating demos.
Also I could not find one place where template::util::is_true is used in the templating code, except in tcl/tag-procs.tcl where the if tag is being defined.
Looking further in the bboard templates, there are lots of this: <code>&lt;if @headings_p@ not nil and @headings_p@ ne "f"&gt;</code>. Wouldn't it be nice being able to replace this with <code>&lt;if @headings_p@ true&gt;</code>? Or even nicer: <code>&lt;if @headings_p@&gt;</code>? (Which one would you rather want to explain to a graphics designer?) This would require to alter the proc that deals with if conditionals a little bit so that it interprets undefined variable names as false.
It would make sense because in most situations booleans in .adp's are used to test if something optional should be included in the page. If it was not set, well then just don't include the optional stuff. Especially in included .adp's that are used from different contexts it's likely to encounter variables that are not defined.
Ah well, propably something for the post-release wishlist ...