arc:select

Version 23.4.8839


arc:select

Version 23.4.8839


The arc:select keyword is similar to a switch-case block in other programming languages and can be used to create complex conditional statements. The body of arc:select can contain one or more arc:case keywords and one arc:default keyword.

The value in arc:select is matched with those specified in arc:case. The body of the arc:case statement contains the keywords and statements to be executed if the value specified matches the value in the arc:select keyword.

The body of the arc:default statement will be executed only if none of the arc:case statements result in a match. The arc:default keyword has no parameters and can appear only once in an arc:select.

Parameters

  • value: The value to compare with those specified in arc:case statements.
  • attr: The attribute whose value is compared with values specified in arc:case statements.

Control Attributes

None

Examples

Set the icon depending on the company name. The arc:case elements match “CompanyA” and “CompanyB” in the company_name attribute, and, if any occurrences are found, take the action associated with that case.

<arc:select value="[company_name]">
  <arc:case value="CompanyA">
    <img src="http://www.companya.com/favicon.ico" />
  </arc:case>
  <arc:case value="CompanyB">
    <img src="http://www.companyb.com/favicon.ico" />
  </arc:case>
  <arc:default>
    <img src="http://www.myhosting.com/generic.ico"/>
  </arc:default>
</arc:select>

See Also