# Dynamic Content Syntax
**PREREQUISITE** : [Dynamic Content](http://inboxmarketer.freshdesk.com/support/solutions/articles/19000043116-how-to-provide-targeted-information-using-dynamic-content) Allows the user to create dynamic content statements without needing to know the syntax. A new syntax has been created in the system which allows developers to keep all content and logic within one document. --- ## Syntax - \##FirstName## - \##FirstName Format="Firstlettercapital"## - \##FirstName Default="Customer"## - \##FirstName Format="Firstlettercapital" Default="Customer"## --- ## Data Types for Format - Email : No formatting options - Text : ALLCAPS, lowercase, Firstlettercapital, EachWordFirstLetterCapital - Number : WholeNumber, OneDecimal, TwoDecimal - Date : MM/dd/yyyy, MM-dd-yyyy, MMMM dd, yyyy, MMM dd, yyyy --- ## Dynamic Content Syntax.
HTML
```html ###variablename### if (field[FieldName] operator "value" ) { "Content" } else if (field[FieldName] operator "value" ) { "Content" } else { "Content" } ###/variablename### ``` --- ## Logic Breakdown (Part 1)
HTML
```html if (field[FieldName] operator "value" ) ``` - FieldName has to match the one in CONNECT, Operators are different depending on the Field type (i.e. Email, Text, Date, Number) - You can have as many else if’s as needed --- ## Logic Breakdown (Part 2) ### Email/Text Operators: ```text equals, is_not, begins_with, contains, not_contain, is_empty, not_empty ``` ### Number/Date Operators:
HTML
```html ==, !=, greater, greater_or_equal, less, less_or_equal, is_empty, not_empty ``` ### AND/OR Statements:
HTML
```html if ((field[ ] ) && (field[ ] )) ```
HTML
```html if ((field[ ] ) || (field[ ] )) ```
HTML
```html if (((field[ ] ) && (field[ ] )) || (field[ ] )) ``` ### For Each Statements: Use the for.each statement by itself:
HTML
```html for.each({"test data"}) for.each({block "
Some text
"}) for.each({image: ""}) ``` Or combined with an IF statement:
HTML
```html if(condition) {block "for.each({"test data"})"} if(condition) {block "for.each({block "
Some text
"})"} if(condition) {block "for.each({image: ""})"} ``` ## Content Types Text: Should only contain text, no HTML. Example:
HTML
```html { "Here is some text" } ``` Image: Should only contain an image tag. Example:
HTML
```html { image"" } ``` Block: Can contain anything including code. Example :
HTML
```html { block"
Some text
" } ``` --- ## Web and Text Versions **Web versions** - Continue to use the ##webversionurl## tag and Connect will handle the rest. - If the client would like different content on their web version vs email message, you can use the following:
HTML
```html if (content[type] == "email" ) or if (content[type] == "webversion") ``` **Text Versions** - Use the "Auto Generate Text Version" option in CONNECT or leave it to the AM. - No separate text version logic required. ## System Variables These variables provide data from the system for various use cases. They all begin with "system" and are proceeded by the variable name. Eg. ##system:deploymentid##
VariableDescription
deploymentidProvides the ID of the deployment at the time of send and is great for adding context to other tracking code.