Enigo Homepage
Client Login
User ID:
Password:

<UNLESS>

Return to Reference...

Property Description Default
condition A method is called and its return value is evaluated as a boolean. If the value is false, 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 <IF> tag. Most often it is used alongside an <IF> tag to form a sort of if/else construct, with both tags checking the same boolean.

Typical Usage:

<unless oid="has_error?"><p>Here are the results of your query:</p>
<pre>@query_data</pre></unless>

Usage Via A Binding:

<unless oid="query_error?"><p>Here are the results of your query:</p>
<pre>@query_data</pre></unless>
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_failed?">Here are the results of your query:</p>
<pre oid="query_failed?">@query_data</pre>
query_failed?:unless {
  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 UNLESS 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 false. It would be as if they were each wrapped in an <UNLESS></UNLESS> 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 <UNLESS> 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?