Mailchimp API和可重复部分 [英] Mailchimp API and Repeatable Sections

查看:53
本文介绍了Mailchimp API和可重复部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能成功使用Mailchimp API填充可重复区域吗?

Has anyone been able to successfully use the Mailchimp API to populate repeatable areas?

尝试了各种尝试,但无济于事.

Have tried all sorts, but to no avail.

在模板中,我有:

div mc:repeatable

div mc:repeatable

div mc:edit="repeat_content"

div mc:edit="repeat_content"

这表明该数组应为:

$content['repeat_content'][] = "Content 1";

$content['repeat_content'][] = "Content 1";

$content['repeat_content'][] = "Content 2";

$content['repeat_content'][] = "Content 2";

但是,在调用campaignTemplateContent时

However, when calling campaignTemplateContent

返回

array ['repeat_content'] = Content1Content2

array['repeat_content'] = Content1Content2

发送的电子邮件中没有任何内容可以替换.

And nothing gets replaced in the Email that is sent.

当我删除mc:repeatable div并只有mc:edit时-内容被很好地替换了.

When I remove the mc:repeatable div and just have mc:edit - the content is replaced fine.

任何帮助将不胜感激!

推荐答案

每个可重复的内容部分都有其自己的唯一mc:edit标识符...

Each repeatable content section has its own unique mc:edit identifier...

如果使用templateInfo方法并查看"sections"数组的内容,您将看到每个附加了索引号(00、01等)

If you use the templateInfo method and view the contents of the "sections" array, you will see each is appended with an index number (00, 01, etc...)

因此,在您的示例中,代码将类似于: $ content ['repeat_content00'] =内容1"; $ content ['repeat_content01'] =内容2";

So in your example, the code would be something like: $content['repeat_content00'] = "Content 1"; $content['repeat_content01'] = "Content 2";

等...

还要注意,通过API不能添加可重复的sectinns,而只能填充现有的(不能隐藏它们)....

Also important to note that through the API you cannot add repeatable sectinns - only populate the existing ones (you cant hide them either)....

mc:edit字段控制模板的各个部分..创建活动时,它将模板复制到活动中(可通过camptaignTemplateContent方法查看).

The mc:edit fields govern the sections of a template.. When you create a campaign it copies the template into the campaign (visable with the camptaignTemplateContent method).

如果您在MailChimps网站上创建广告系列,请重复一个部分,然后调用campaignTemplateCOntent方法,您会发现它不包含重复的部分/内容... campaignTemplateContent是模板的原始副本.

If you create a campaign on MailChimps site, repeat a section, and call the campaignTemplateCOntent method you will notice it does not include the repeated section/content... The campaignTemplateContent is the raw copy of the template.

现在,如果您调用campaignContent方法,您将看到带有重复的部分/修改的html(和/或文本)内容...

Now if you call the campaignContent method you will see the html (and/or text) content with repeated sections/modifications...

这样想: 您有您的模板. 创建广告系列时,它将模板复制到广告系列(campaignTemplateContent)

Think of it like this: You have your templates. When you create a campaign it copies the template into the campaign (campaignTemplateContent)

当您在mailchimp的编辑器中编辑广告系列模板时,您可以重复部分..修改后的数据实际上存储在campaignTemplateContent部分中...

When you edit the campaign template in mailchimp's editor you can repeate sections.. The modified data is actually stored in the campaignTemplateContent section...

MailChimp所见即所得编辑器(自定义CKEditor)使用mc:edit,mc:repeatable和mc:hidable标签来编辑campaignContent(我确信编辑器也从campaignTemplateInfo中提取了内容).但是这些标签对api毫无意义.API只是提取mc:edit字段来确定自定义内容部分...

The MailChimp WYSIWYG editor (customized CKEditor) uses the mc:edit, mc:repeatable and mc:hidable tags to edit the campaignContent (I am sure the editor also pulls from the campaignTemplateInfo). But these tags mean nothing to the api.. The API just pulls the mc:edit fields to determine the custom content sections...

最终,如果您需要适用于该API的模板,则应在客户端上创建内容,然后将其传递给mailchimp.

Ultimately, if you need an adaptable template for the API, you should create the content on the client side and then pass it to mailchimp.

我刚刚发现了一个有趣的发现:MC编辑器从原始模板中提取并将已编辑/可编辑的值存储在campaignTemplateContent ...中(呈现的版本存储在campaignContent ...中)

Just an interesting observation I just found: The MC editor pulls from the original template and stores the edited/ediable values in campaignTemplateContent... (The rendered version is stored in campaignContent...)

campaignTemplateContent按照模板mc:edit字段的顺序进行排序.

The campaignTemplateContent is ordered by the order of the template mc:edit fields..

因此,当您修改模板时,campaignTemplateContent字段将基于新模板进行重新排序...

So when you modify a template the campaignTemplateContent fields will reorder based on the new template...

此外,在创建广告系列后-如果您编辑模板并删除某个部分,则该部分仍存储在campaignTemplateContent ...

Also, after creating a campaign - if you edit the template and remove a section the section is still stored in the campaignTemplateContent...

很有意思,因为在混乱中的某处是克服排序/排序问题的逻辑

Just interesting because somewhere in that mess is the logic for overcomming the ordering/sorting issue

这篇关于Mailchimp API和可重复部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆