The j:set_if tag

The j:set_if tag is used to set the value of a variable based on a condition. If the condition evaluates to true, the value specified in the true attribute is set. Otherwise, the value specified in the false attribute is set. It is similar to the ternary operator in many programming languages--var x = test ?true : false. It accepts the following attributes:

  • var: The name of the variable to set. We usually use the jvar_ prefix for consistency.
  • test: The test expression to be used to determine whether to evaluate the true or false value. This should be a Jelly expression enclosed in ${} or $[], and must evaluate to boolean value.
  • true: The value to set the variable to if the expression in the test attribute evaluates to true.
  • false: The value to set the variable to if the expression in the test attribute evaluates to false.

For example:

<g2:set_if  
var="jvar_style"  
test="$[gs.getPreference('table.compact') != 'false']"  
true="margin-top:0px; margin-bottom:0px;"  
false="margin-top:2px;  
margin-bottom:2px;" /> 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.19.251