Any of making API + mc:repeatable + mc:variant working?

1,143 views
Skip to first unread message

Oncle Tom

unread,
Nov 26, 2012, 10:17:06 AM11/26/12
to mailchimp-...@googlegroups.com
Hello everybody,

I've digged into Mailchimp API wrapper in PHP yesterday, created a template and tried to send a new campagin programmatically.
The knowledge base is totally silent about the usage of this feature through the API.

First of all, I have a structure similar to this one:

~~~~
<div class="content">
  <div mc:repeatable="post" mc:variant="editorial content">
    <h2 mc:edit="title00">Editorial Title</h2>
    
    <img mc:edit="thumbnail00 style="max-width:600px" />
    <!-- specific content -->
  </div>
  <div mc:repeatable="post" mc:variant="regular content">
    <h2 mc:edit="title00">Regular Title</h2>

    <img mc:edit="thumbnail00 style="max-width:125px" />
    
    <!-- specific content -->
  </div>
  <div mc:repeatable="post" mc:variant="sponsored content">
    <!-- specific content -->
  </div>
</div>
~~~~

I saved the template, manually created a new campaign an I was able to add new sections with the variant dropdown selector.
New sections are created accordingly the presentation variant I designed in the template.

In my use case, I have a variant amount of repeatable items in campaigns.
Many questions:
* what is the content structure for that? I tried html_thumbnail00+html_thumbnail01 etc. html_post:thumbnail00+html_post:thumbnail01 etc. but my campaign shows up only the first content (with default values)
* the mc:repeatindex appears nowhere in the documentation but is added somewhat to the campaign template when I create it manually; what's the purpose, is it mandatory?
* is it at least doable through the API? It is not officially written in any doc published in the KB, code samples or even the API itself

Thanks for the support :-)
Cheers

jesse

unread,
Nov 26, 2012, 10:36:23 AM11/26/12
to mailchimp-...@googlegroups.com
Those are generally meant for use by folks manually editing campaigns where it makes more sense to enable interactively adding sections since using the API to populate content by default means you can programatically include whatever you need to. If you feel that route is the best solution, however, there are some posts in this group where folks have hammered out doing that. For example:

https://groups.google.com/forum/#!searchin/mailchimp-api-discuss/repeatable/mailchimp-api-discuss/TU9OIvMindo/u5zE4aUl9M0J
https://groups.google.com/forum/#!searchin/mailchimp-api-discuss/repeatable/mailchimp-api-discuss/DnY2AwKfzd8/stjKtA7ROiYJ
https://groups.google.com/forum/#!searchin/mailchimp-api-discuss/repeatable/mailchimp-api-discuss/Y4dHXTlIkeY/HhcYOvMffywJ


jesse

Oncle Tom

unread,
Nov 26, 2012, 11:00:19 AM11/26/12
to mailchimp-...@googlegroups.com
Hi jesse,

so definitely the first link you provided helped me to solve the content population.
Despite I had `mc:repeatable="post"`, mailchimp deals as it was named `mc:repeatable="repeat_1"`.
So this point is OK, I can now inject the proper content.

The mc:variant problem is still there anyway. Is there another syntax specific to tell which variant to use with the repeatable index?

Oncle Tom

unread,
Nov 26, 2012, 11:10:04 AM11/26/12
to mailchimp-...@googlegroups.com
To detail a bit more my answer, as I read you said mc:variant is essentially here for visual design.

For me it's a smart feature to keep data and their visualization separated.
I mean, from the API I just want to send back the data ; and in the template, I organize how they are displayed and where.

It's basically the same relationship between HTML and CSS.
Reply all
Reply to author
Forward
0 new messages