通过API遍历mailchimp模板中的集合 [英] Iterating over collection in mailchimp template via API

查看:133
本文介绍了通过API遍历mailchimp模板中的集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有机会通过API填写可重复的部分?因此,例如,我有一个产品列表,并且我只想在模板中有一次产品"部分,然后遍历集合.我已经阅读了有关此主题的先前讨论,并用谷歌搜索,但我仍然不知道是否可以通过API来实现.

Is there any chance to fill in repeatable sections via API? So for example I have list of products and I want to have product section only once in template and then iterate over collection. I have read previous discussion on this topics and googled but I still don't understand whether it is possible via an API.

 <!-- repeatable block -->
 <div mc:repeatable>
   <h2 mc:edit="product_title">Title</h2>
   <p mc:edit="product_description">Body</p>
 </div>
 <!-- /repeatable -->

所以我可以提供这样的东西吗?

So can I supply something like this:

 html_product_title[0] = "Product1"
 html_product_description[0] = "Description1"
 html_product_title[1] = "Product2" 
 html_product_description[1] = "Description2"

此可重复部分是否重复了两次?或者也许我必须以另一种方式命名键?

And have this repeatable section repeated twice? Or maybe I have to name keys in some kind of another manner?

谢谢!

推荐答案

简短答案:否

我只是在另一个S.O上更深入地回答了这个问题.问题

I just answered this more in depth on another S.O. question

Mailchimp API和可重复部分

不起作用的简短答案:mailchimp WYSIWYG编辑器(自定义CKEdit)提供了可重复部分.它使用可重复标记(mc:repeatable)复制内容.

Short answer why it doesn't work: The repeatable sections are available with the mailchimp WYSIWYG editor (Custom CKEdit) .. It uses the repeatable tag (mc:repeatable) to duplicate the content.

从API的角度来看,可用的内容/部分仅是原始模板上的内容/部分...即使您编辑和/或重复一个部分并拉出campaignTemplateContent方法,它也会返回原始模板的内容. .(因为它是正在使用的基本模板)...

From the standpoint of the API, the content / sections available are only those on the original template... Even if you edit and/or repeat a section and pull the campaignTemplateContent method it will return the content of the original template.. (Because it is the base template being used)...

mc:edit,mc:repeatable和mc:hidable字段都是其自定义编辑器的一部分...

The mc:edit, mc:repeatable, and mc:hidable fields all are part of their custom editor...

mc:edit字段还用于确定内容部分...(这就是api调用返回标记部分的完整html内容的原因...)

The mc:edit field is also used to determine the content sections... (This is why the api calls return the FULL html contents of the tagged sections...)

您最好的选择是即时生成模板,然后使用API​​上传....或者,如果您要包含的产品数量是静态的,则可以设置模板,然后只需填写以下部分(如果您使用这些部分设置BASE模板,则每个部分都会有一个自定义mc:edit标识符,可用于填充这些部分.)

Your best bet is to generate the template on the fly and then upload it using the API... That or if you have a static number of products you are including you could set a template and then just fill in the sections (if you setup the BASE template with the sections, each section will have a custom mc:edit identifier that can be used to populate the sections..)

每个部分的前面都带有一个标识... 'repeated_content00''repeated_content01'...但这又在基本模板中(不是广告系列编辑的模板中)...

Each section will be prepended with an identifuer... e.g. 'repeated_content00' 'repeated_content01'... But again, this is in the base template (not campaign edited template)...

这篇关于通过API遍历mailchimp模板中的集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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