i4w_select
Usage
This shortcode returns a value from a list, based on a switch variable, similar to a "switch…case…" programming construct.
[ELSE_select] conditional branching is NOT supported.
Shortcode nesting is NOT supported.
Parameters
| Parameter | Description | Default | Required |
|---|---|---|---|
| case | A list of values, separated by '|' (pipe). The first item in the list is the switch value to be compared against the remaining values. | None | Yes |
Example
Shortcode
[i4w_select case='2|yes|no|maybe']
Returns 'no' (the 2nd value after the switch).
Shortcode
[i4w_select case='maybe|yes|no|maybe']
Returns '3' (the ordinal position of the matching value).
Notes
info
If a number (integer) is used as the switch variable, the n-th ordinal value will be returned, if there is one.
If a string (alphanumeric) is used as the switch variable, the ordinal number of the matching value is returned (if the third item matches, a 3 is returned).