0

尝试使用 MJML 为某些客户提供每日电子邮件摘要。

我使用 str_replace 复制电子邮件模板中预先构建的表行,然后编译。

出于某种原因,一旦我使用我的代码——MJML 就会在布局中复制表格和螺丝。即使我直接使用他们文档中的代码并输入我自己的话,它也会扭曲它。

任何人都可以找出原因

非工作代码

  <mjml>
    <mj-body>
      <mj-container>
        <mj-section>
          <mj-column>
            <mj-table>
              <tr style="border-bottom:1px solid #ecedee;text-align:left;padding:15px 0;">
                <th style="padding: 0 15px 0 0;">Inventory Type</th>
                <th style="padding: 0 15px;">Subtotal</th>
                <th style="padding: 0 0 0 15px;">Total</th>
              </tr>
              <tr>
                <td style="padding: 0 15px 0 0;">Unknown</td>
                <td style="padding: 0 15px;">$5843.55</td>
                <td style="padding: 0 0 0 15px;">$4047</td>
              </tr>
              <tr>
                <td style="padding: 0 15px 0 0;">Solid Marijuana Infused Edible</td>
                <td style="padding: 0 15px;">$318</td>
                <td style="padding: 0 0 0 15px;">$214</td>
              </tr>  
            </mj-table>
          </mj-column>
        </mj-section>
      </mj-container>
    </mj-body>
  </mjml>

在线编译器:https ://mjml.io/try-it-live/ByJDBobEx

版本:3.1.1

4

1 回答 1

1

Sorry for the issue! This is caused by the $ character which is followed by 214 (if you try to add a space between $ and 214 you'll see the second table disappear). It's a known issue of the MJML parser, the implementation of a new parser is on our mid-term roadmap (we'll start working on it early 2017).

I can suggest you a workaround: try replacing the $ signs by the HTML entities &#36;. Working example here: https://mjml.io/try-it-live/rkiWU3b4g.

Hope it helps!

于 2016-12-16T18:46:27.807 回答