Replacing a module with a snippet in a modular email template | Community
Skip to main content
New Participant
August 19, 2021
Solved

Replacing a module with a snippet in a modular email template

  • August 19, 2021
  • 1 reply
  • 4390 views

Hi 😊

 

Has anyone been successful at replacing entire modules with dynamic snippets in a modular email template using the following method:

  1. adding the entire module HTML to the snippet; and 
  2. adding <div class="mktoSnippet" id="example" mktoName="example" mktoDefaultSnippetId="12"></div> to the email template nested between <td> tags, for example: 
<!-- Module Starts --> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="mktoModule" mktoname="Header Logo" id="header_logo"> <tr> <td> <div class="mktoSnippet" id="headerLogo" mktoName="Header Logo" mktoDefaultSnippetId="47B2"></div> </td> </tr> </table> <!-- Module Ends -->

 

(source: https://experienceleague.adobe.com/docs/marketo/using/product-docs/email-marketing/general/email-editor-2/email-template-syntax.html?lang=en

 

I haven't notice any issues with this approach but would hate for something to wrong after I have migrated the large number of assets in our database to the new template. I got in touch with Marketo Support and they said it is not possible to replace an entire module (as opposed to editable elements) in an email template and that they couldn't help with HTML questions.

 

Any thoughts would be much appreciated!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jasbirka

Hi,

 

Yes, you can replace the entire module with a snippet by using the below code - 

 

<tr class="mktoModule" id="DisclaimerSec" mktoname="Disclaimer Snippet"> <td> <table style="border-spacing: 0; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <div class="mktoSnippet" id="Disclaimer" mktoName="Disclaimer Snippet" mktoDefaultSnippetId="1785"></div> </td> </tr> </table> </td> </tr>

 

NOTE - 

  • Please do not add any Marketo classes, variables, elements in the code which you want to replace with the snippet because it will not work with snippet.
  • Use just simple HTML there.

 

Please let me know in case of any concerns.

 

Thanks & Regards,

Jasbir

 

 

1 reply

JasbirkaAccepted solution
New Participant
August 19, 2021

Hi,

 

Yes, you can replace the entire module with a snippet by using the below code - 

 

<tr class="mktoModule" id="DisclaimerSec" mktoname="Disclaimer Snippet"> <td> <table style="border-spacing: 0; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <div class="mktoSnippet" id="Disclaimer" mktoName="Disclaimer Snippet" mktoDefaultSnippetId="1785"></div> </td> </tr> </table> </td> </tr>

 

NOTE - 

  • Please do not add any Marketo classes, variables, elements in the code which you want to replace with the snippet because it will not work with snippet.
  • Use just simple HTML there.

 

Please let me know in case of any concerns.

 

Thanks & Regards,

Jasbir

 

 

LillyFaAuthor
New Participant
August 20, 2021

Hi @jasbirka  😊

 

This is incredibly helpful! Thank you so much. 

 

I have been getting a whole bunch of Error: Invalid Module and Error: Duplicate Element when trying to validate the code. Could this be because I didn't remove Marketo classes, variables, and elements from the snippet code for eg. class="mktoModule" mktoname="Section Events" id="section_events, class="mktEditable" id="text_29? 

New Participant
August 20, 2021

Hi @lillyfa 

 

Yes, you have to remove all the Marketo classes, variables, elements from the snippet code, use simple HTML in the snippet, just like the below - 

 

<table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td style="background-color: #ffffff;" bgcolor="#ffffff"> <table class="deviceWidth1" style="width: 520px; margin: 0 auto;" width="520" cellspacing="0" cellpadding="0" border="0" align="center"> <tbody> <tr> <td style="line-height: 1px; font-size: 1px;" height="22">&nbsp;</td> </tr> <tr> <td style="font-family: Arial, sans-serif, helvetica; font-size: 11px; line-height: 14px; color: #000000; mso-line-height-rule: exactly;"> Text goes here </td> </tr> <tr> <td style="line-height: 1px; font-size: 1px;" height="27">&nbsp;</td> </tr> </tbody> </table> </td> </tr> </tbody> </table>

 

By using the above, you will not get any error.

 

Let me know if you still face any issue.

 

Thanks & Regards,

Jasbir