s:case

Create complex conditions

The following snippet shows how you can detect if a number is two-digit by checking if it's both bigger than 9 and smaller than 100.

INPUT
<s:set var="x">70</s:set>
<s:case name="number is two-digit?">
    <s:if true="{{ x }} {{ > }} 9" return />
    <s:if true="{{ x }} {{ < }} 100" return />
</s:case>
{{ number is two-digit? }}
OUTPUT
#true
NOTE: By default, <case> checks if all conditions are #true. But, you can change this behaviour by using one of these attributes: all-true, any-true, all-false, any-false.
NOTE: You can nest <case> tags to create even more complex conditions using the return= attribute.
☼ ☼ ☼ anotomy ☼ ☼ ☼
var=""  name=""  

Use this variable name to save the condition of our <case>.

all-true=""  

This is the default behaviour.

Return #true if all of the conditions are #true.

any-true=""  

Return #true if any of the conditions are #true.

all-false=""  

Return #true if all of the conditions are #false.

any-false=""  

Return #true if any of the conditions are #false.

return=""  

Return #true or #false instead of just setting the variable name.

Use this attribute if you want to nest a <case> inside another one, just like an <if>.