Is it possible to code drag&drop templates for mailchimp?

痞子三分冷 提交于 2019-12-05 18:31:00

You can use drag and drop, but it's not documented any where that I could find. I was able to get the source code they used to get the "content" and "design" panels to appear on the righthand side.

Code:

In order to get the "content" panel to appear you need to use code in this gist! It's just the source code from the single column basic template. Paste the code into the "Edit Code" panel. You just need to follow the proper formatting in the file. I haven't parsed through it yet to tell you what is exactly does what.

Things you already knew.

The documentation on how to modify your templates (mc:edit="body") and have the design panel can be found here MailChimp's Knowledge Base: Code Your Own

Seems like, they did not like people to use this... When you save the code using their backend, they will now strip out the mccontainer="footer_container" attribute and so you will no longer be able to see the elements you added using the "design" mode in the preview or the rendered email.

As an example, this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
  <body>
    <h1>I'm super simple</h1>
    <div mc:container="footer_container" mccontainer="footer_container"></div>
    <div></div>
  </body>
</html>

Will get this after you save the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
  <body>
    <h1>I'm super simple</h1>
    <div mc:container="footer_container"></div>
    <div></div>
  </body>
</html>

So you can edit the template using the drag and drop feature, but you will not see any results in the rendered email...

I found edesilets' answer helpful. I uploaded the gist file as a mailchimp template and started removing elements until I found what broke the drag and drop editor.

If you add the following code into your main content div or td it will enable the drag and drop block editor:

mc:container="body_container" mccontainer="body_container"

example:

<div  mc:container="body_container" mccontainer="body_container"></div>

This code will add a block editor region to the preheader section:

  mc:container="preheader_container" mccontainer="preheader_container"

For the header:

  mc:container="header_container" mccontainer="header_container" 

For the footer:

 mc:container="footer_container" mccontainer="footer_container"

Note: It doesn't seem to matter what you call the mc:container. Creating a new container with a different name worked. Although using just mc:container tag seems to work at first by itself, the mccontainer (no colon) tag is required for it to save properly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!