Dynamic Invoice, Emails and Wire Details, using the {if} Syntax

RSMemberhip! allows you to show or hide a text or membership custom field values using the {if} syntax. This can be used in:


This syntax is based on a simple if condition and looks like this:

{if {name_of_field}} Display this text if the name_of_field field has a value.{/if}

You will need to replace name_of_field with your actual field's name.

Note: The syntax is similar to HTML as it has an opening and an ending tag.


RSMembership! also allows you to compare the value of the field when using if statements.

Example:

{if {name_of_field}}The message is {name_of_field}.{/if}

The string found within the {if} syntax will not show if the field has no value.


The {if} clause also accept the following operators:

<= , >=, <>, <, >, !=, =,==,===, <-, ->


Assuming that you have a checkbox and you need to compare its value with a specific string, you will use:

{if {Checkbox}<-Item1}This text will be displayed if the Item1 value is selected, regardless of any other selections{/if}


If you want to display a text if the checkbox has only at least one of your desired values, you will use the following syntax:

{if {Checkbox}->Item1,Item2}This text will be displayed if one of the following values is selected: Item1 or Item2, or if both are selected. It will not display if another additional value is selected{/if}


If you want to see if the user entered a specific value into a field you can use the following syntax (works for a single checkbox value as well):

{if {field_name}=Your desired value} this text gets displayed only if the placeholder has the "Your desired value" value {/if}


You can also compare two placeholder values using <, >, <= or >=

{if {field_name}<{other_field}} this text will be displayed if {field_name} has a lower value {/if}

Notice the blank space between "if" and the field placeholder.


You can also use a nested {if} syntax, for example:

{if {field1_name} = value1}
{if {field2_name} = some value}
this text will be displayed if {field1_name} has 'value1' selected and 'some value' in the {field2_name}
{/if}
{/if}

Was this article helpful?

Yes No
Sorry about that