# What are content blocks?

Content blocks allow users to insert dynamic content in their email by creating a dynamic variable that displays information relative to the information retrieved for a specific record type in Datamart. These variables are user created and defined.

**What is the difference between a Content Rule and Content block?**

- The immediate difference is the way these two types of variables are displayed on the HTML document. 
    - **\##Variable##** (content rule variable)
    - **\###Variable###** (content block variable)
- A Content Rule applies to the whole email and allows for 1 conditional rule to affect multiple variables in the message. A Content Block is a single condition and a single variable affecting a single block or object in the message.

**How to use Content Blocks?**

- Go to Compose &gt; Email Message &gt; Create new message &gt; Standard &gt; HTML.
- Since, this article primarily focuses on Content Blocks, we will deal with HTML, Preview and Test tab.
- In the HTML tab, select Insert **Dynamic Content button**.

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289646753.png)

- A window will display like one shown below:

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289653417.png)

This helps users in customizing how the content will be displayed by the content block variable.

**1. Name**: Provide a name to dynamic variable. This will be inserted into the HTML section (Image shown below - highlighted by yellow border).

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289660675.png)

**2.** CONNECT allows users to program the entire logic by switching to **HTML** mode from **Design** mode. (Example shown below)

**Design mode:**

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289666344.png)

**HTML mode:**

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289675436.png)

**3. Copy:** New content blocks can be created from previously created ones simply by selecting the drop down list next to the Copy option.

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289683711.png)

- **Important**: When copying previous variable logic, current logic will be discarded. Also, name the content block different than the parent block.

 **Insert:** Click this button to insert the dynamic variable in the email message.

 **Cancel:** Click this button to discard current dynamic variable creation.

Now, we have to add the logic for the insertion of content. This is done using if/else statements.

- If a record has the field Division equivalent to â€œFood Servicesâ€� then â€œGloves on Sale!â€� will be displayed in the email.

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289688854.png)

 Result in preview tab

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289694027.png)

---

- Else if Division is equal to â€œCleaningâ€� then â€œNew Microfiber Mopsâ€� will be displayed.

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289702753.png)

 Result in preview tab:

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289712148.png)

---

- Finally, an else statement which means if none of the above statement applies, then the following text is displayed: â€œ15% Off Select Itemsâ€�.

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289717805.png)

 Result in preview tab:

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289729029.png)

- Also, the else if, or else statement, could be removed by clicking ![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289740769.png)

---

**Dynamic content block variables also support image, text and blocks of code.**

To insert an image:

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289752441.png)

To insert a block:

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289758175.png)

User could further edit the Block by selecting **Edit** button. The following window will be displayed:

![](http://kb.connect.tekside.io/uploads/images/gallery/2020-01/scaled-1680-/image-1579289764497.png)

- User has the option to test their block using Preview or by creating a test deployment.