# Conditional display

## Tag Structure <a href="#tag-structure" id="tag-structure"></a>

**{if:**&#x56;ARIABLE OPERATOR VALU&#x45;**}**...text you want to display or remove...**{/if}**

You can use any variable from the user profile (so name, email, subid, userid or any other custom field you created) You can use the operators:

* \= (which means equal)
* != (which means different)
* \> (superior to)
* < (inferior to)
* \~ (contains the string)
* !\~ (does not contain the string)

&#x20;The test is case-insensitive.

You can also use values returned by another tag in the conditional display by using the format: {if:var.{yourtaghere}=3}...{/if} For example if you created a field on Community Builder: {if:var.{tagcb:cb\_gender}=M}this text will be displayed for Male{/if}

You can also test based on Joomla profile values using the format: {if:joomla.joomlafield=value}...{/if}

## Examples <a href="#examples" id="examples"></a>

### Display text for registered users only <a href="#display-text-for-registered-users-only" id="display-text-for-registered-users-only"></a>

{if:userid!=0}You're one of our registered users!{/if}

### Display text for visitors (users without a Joomla account) only <a href="#display-text-for-visitors-users-without-a-joomla-account-only" id="display-text-for-visitors-users-without-a-joomla-account-only"></a>

{if:userid=0}What? You're not a registered user?? Let's create your account now!{/if}

### Display text based on the user's interests (created with the AcyMailing Enterprise custom fields) <a href="#display-text-based-on-the-users-interests-created-with-the-acymailing-enterprise-custom-fields" id="display-text-based-on-the-users-interests-created-with-the-acymailing-enterprise-custom-fields"></a>

If you create a custom field with checkboxes to select user's interests, you should then use the operator "\~" as a user may have several interests. {if:mycats\~sports}Here I will display sports articles{/if}

### Display text if the field does not have value <a href="#display-text-if-the-field-does-not-have-value" id="display-text-if-the-field-does-not-have-value"></a>

{if:occupation= }You didn't enter your occupation... don't forget to update your profile on our website!{/if} (You should add a space after the operator)

### Display text according to the list subscription <a href="#display-text-according-to-the-list-subscription" id="display-text-according-to-the-list-subscription"></a>

If you want to display some text according to the list subscription, you can use the tag giving all lists the user is subscribed to. Then search if your list name is inside: {if:var.{list:names}\~your first list name}Message for your first list{/if} {if:var.{list:names}\~your second list name}Message for your second list{/if}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acymailing.com/old/developers/conditional-display.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
