Highlighted

Collapsing content blocks?

curtisv6802366

30-04-2018

Is it possible to have a dynamic content block collapse completely? 

An example of the goal we are trying to achieve.  Within a dynamic content block we have three variations: the default, block A and block B.  Block A will appear if the profile is 21-30 years old.  Block B will appear if the profile is 31-40 years old.  If the profile doesn't fit within either of those age ranges, we'd like for this block to collapse and disappear completely.  If we leave the default block empty it does collapse but not completely, it still leaves one line of code.  Outside of creating a two separate template, is it possible to have a block collapse completely?

Replies

Highlighted

AbdulZa

30-04-2018

I have the same question. Our client has an email layout/template with 8 zones/dynamic blocks. Local dealer campaigns are simple and the they may use only 1-2 zones/blocks. We are researching the same capability.

Highlighted

davidl14970702

30-04-2018

I do this regularly. See Screen Shot below. In that email there are several combinations (usually 20-30 ) of each block depending on what city there person is registered to attend. Here is my Litmus code if you want to see Builder , the images probably wont render but you can get a better idea.

Based on what you listed here is how I would approach your scenario.

<% if ( recipient.age >= 21 && recipient.age <= 30 ){ %><!--Block A HTML begins Here--><% }

else if ( recipient.age >= 31 && recipient.age <= 40 ) %><!-- Block B HTML begins Here--><% }

else { %><!--default Block HTML begins Here --><% } %>

When using the If statements I've found it important to nest comments with the statements. If they are right before the JS it will have errors.

Hope this helps.

Here is the email I did (well part of it, there are a lot of combinations).

blocks.png

Highlighted