i4w_compare
Usage
This shortcode provides the ability to compare any two values based on a number of comparison operators.
The comparison operators are:
| Operator | Symbol | Alias |
|---|---|---|
| equal | == | EQ |
| greater than | > | GT |
| less than | < | LT |
| greater or equal | >= | GE |
| less or equal | <= | LE |
| not equal | <> | NE |
| begins with | ~= | BW |
| ends with | =~ | EW |
| contains | ~~ | CONTAINS |
Any two values may be compared. The values may be hardcoded or be other shortcodes, custom shortcode parameters and session variables.
[ELSE_compare] conditional branching is supported.
Shortcode nesting is supported: [i4w_compare1] thru [i4w_compare19]
[ELSE_compare1] thru [ELSE_compare19]
Parameters
| Parameter | Description | Default | Required |
|---|---|---|---|
| value1 | The name of a contact field or custom field shortcode, a custom shortcode parameter or a hardcoded value, which will be compared to value2 based on the comparison operator. | None | Yes |
| cmp | The comparison operator, as listed above. | None | Yes |
| value2 | The name of a contact field or custom field shortcode, a custom shortcode parameter or a hardcoded value, which will be compared to value1 based on the comparison operator. | None | Yes |
Example
Shortcode
[i4w_compare value1='[i4w_db_firstname]' cmp='EQ' value2='Bob']
Hello Bob!
[ELSE_compare]
Hello Friend!
[/i4w_compare]