I'm building a MailChimp template and would like to have nested repeatable variants. Something like this
-- Variant 1A
-- Variant 2A
-- Variant 2B
-- Variant 1B
-- Variant 3A
-- Variant 3B
-- Variant 1C
-- Variant 4A
-- Variant 4B
When I nest mc:repeatable=""
and mc:variant=""
elements inside another repeatable/variant tag it doesn't work. The inner repeatables don't appear in the editor. Removing the inner repeatable/variant tags makes the content appear again, but the ability to repeat the content blocks is lost obviously.
Here's a full example of the code:
<tr mc:repeatable>
<td>
<table>
<tr mc:repeatable="rating" mc:variant="variant1">
<td>
<div mc:edit="text">
</div>
</td>
</tr>
<tr mc:repeatable="rating" mc:variant="variant2">
<td>
<div mc:edit="text">
</div>
</td>
</tr>
</table>
</td>
</tr>
Has anyone been able to nest repeatable/variant blocks in a MailChimp template?
Looking at mc:repeatable in MailChimp's Reference apparently it is possible to nest repeatable elements within repeatable elements, though it's "not encouraged"
http://templates.mailchimp.com/getting-started/template-language/
I'm also trying to do something similar, from what I can tell, it doesn't seem possible to use a mc:variant inside a mc:repeatable and have it work the way we want.
Using the following:
<div mc:repeatable="repeat-wrapper">
<h1>Repeat wrapper</h1>
<tr>
<td>
<div mc:repeatable="catsdogsbirdsfish"
mc:variant="meow meow meow!">
<h1>Meow!</h1>
Cats are the best!
</div>
<div mc:repeatable="catsdogsbirdsfish"
mc:variant="woof woof woof!">
<h1>Woof!</h1>
Dogs are the best!
</div>
<div mc:repeatable="catsdogsbirdsfish"
mc:variant="tweet tweet tweet!">
<h1>Tweet!</h1>
Birds are the best!
</div>
<div mc:repeatable="catsdogsbirdsfish"
mc:variant="glub glub glub!">
<h1>Glub?</h1>
I don't know what sounds fish make,
but they are the best!
</div>
</td>
<td><p>End of the repeating element</p></td>
</tr>
</div>
I could create and repeat any number of Cats, Dogs, Birds or Fish. The repeating UI appeared along with the variant dropdown selector. I could also create a new Repeat Wrapper but I could not insert any Cats, Dogs or Birds inside the newly repeated container :/
You can't nest repeatable within repeatable
From MailChimp:
The mc:repeatable attribute defines a content block that can be repeatedly added to the template. When using mc:repeatable, make sure to use proper nesting of items. An mc:repeatable section should never be contained within an mc:edit section. Instead, nest your mc:edit sections within your mc:repeatable blocks. Never nest mc:repeatable blocks within other mc:repeatable blocks, mc:edit areas within other mc:edit areas, or mc:edit images within mc:edit areas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With