Enigo Homepage
Client Login
User ID:
Password:

<IF>

Return to Reference...

Property Description Default
condition A method is called and its return value is evaluated as a boolean. If the value is true, then the content inside of the tag is displayed. {oid} : names the method/accessor to check the value of.

This tag provides the designer with a way to conditionally choose whether or not to display a piece of content inside of the template. It is the opposite of the <UNLESS> tag.

Typical Usage:

<if oid="has_error?"><p>The query generated an unexpected
error message.  Please inform your application administrator.  The error that
occured follows.</p>
<pre>@error_string</pre></if>

Usage Via A Binding:

<if oid="query_error?"><p>The query generated an unexpected
error message.  Please inform your application administrator.  The error that
occured follows.</p>
<pre>@error_string</pre></if>
query_error? {
  condition = has_error?
}

This tag is not typically used with a binding, currently, but one might want to do this in order to enable the developer to change the method that is being invoked without having to change the content template.

Proposed Feature For Version 0.21 (currently being evaluated)

<p oid="query_error?">The query generated an unexpected
error message.  Please inform your application administrator.  The error that
occured follows.</p>
<pre oid="query_error?">@error_string</pre>
query_error?:if {
  condition = has_error?
}

This capability would let one grant dynamic capabilities to other tags. In this example, the binding is specifically being declared to be an IF type binding. By attaching it to the <P> and the <PRE> tags, which are not normally dynamic in any way, those tags and their content would only display if the condition evaluated to true. It would be as if they were each wrapped in an <IF></IF> block, but that behavior could be controlled from the code instead of the template. The current behavior, if one tries this, has the <P> and the <PRE> tags behaving exactly like an <IF> tag. i.e. the content of the tag is displayed, but the tag itself is not.

Return to Reference...
Do you have a comment or a suggestion?