SOLVED

Replacing a module with a snippet in a modular email template

Go to solution
lillyfalcon
Level 3

Replacing a module with a snippet in a modular email template

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-edi...

 

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!

Lilly Falcon
2 ACCEPTED SOLUTIONS

Accepted Solutions
Jasbir_Kaur
Level 5

Re: Replacing a module with a snippet in a modular email template

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

 

 

View solution in original post

Jasbir_Kaur
Level 5

Re: Replacing a module with a snippet in a modular email template

Hi @lillyfalcon 

 

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 

View solution in original post

5 REPLIES 5
Jasbir_Kaur
Level 5

Re: Replacing a module with a snippet in a modular email template

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

 

 

lillyfalcon
Level 3

Re: Replacing a module with a snippet in a modular email template

Hi @Jasbir_Kaur  😊

 

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? 

Lilly Falcon
Jasbir_Kaur
Level 5

Re: Replacing a module with a snippet in a modular email template

Hi @lillyfalcon 

 

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 

lillyfalcon
Level 3

Re: Replacing a module with a snippet in a modular email template

@Jasbir_Kaur I made the changes you suggested but I'm still getting the Error: Invalid Module (all modules) and Error: Duplicate Element Id (for elements in the template as opposed to the snippets). I have checked all my elements and they have unique Ids so I'm not sure what else to do!

 

I've looked into the Error: Invalid Module and found that The Email Template Syntax documentation https://experienceleague.adobe.com/docs/marketo/using/product-docs/email-marketing/general/email-edi... specifies that: 

For containers of type <td>:

Modules are specified using <table> with class=“mktoModule”

 

Our container is set at above the first module and looks like this: 

<!-- Main -->
<tr>
<td class="mktoContainer" id="main" bgcolor="#ffffff">

 

so I have moved the mktoModule classes back into the <table> tags 

 

Any ideas about why I could be getting these errors? I've read in a different discussion that a Marketo Container can only contain Marketo modules, and that these modules must be direct children of the mktoContainer element.

 

In my example code below are the modules and snippets nested:

 

									<!-- Main -->
									
<tr>
<td class="mktoContainer" id="main" bgcolor="#ffffff">
											<!-- Header -->
											
											<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mktoModule" mktoname="Header" id="header">
									
			<tr>
				<td>											
					<div class="mktoSnippet" id="headerCTA" mktoName="HeaderwithCTA" mktoDefaultSnippetId="48B2"></div>
				</td>												
			</tr>											
		</table>

											<!-- END Header -->
											<!-- Header Logo -->
											
	<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="HeaderwithLogo" mktoDefaultSnippetId="47B2"></div>
				</td>												
			</tr>											
		</table>
										<!-- END Header Logo -->

 

Thanks again,

Lilly Falcon
lillyfalcon
Level 3

Re: Replacing a module with a snippet in a modular email template

@Jasbir_Kaur I just tried pasting the code again and it allowed me to approve the template !! 🙌 

 

Very grateful for all your help 😊

Lilly Falcon