all things Sitecore related

Sitecore ECM: How to create a e-mail template from Scratch – Part II

In this post I will extend the basic e-mail template for Sitecore ECM with a title and text listing. With this e-mail template the business user can create new Title and Text items within the page-editor (Sitecore 6.4 and higher) or the content-editor (all versions of Sitecore). This article is a follow-up article of the Sitecore ECM: How to create a Email template from Scratch – Part I.

Create the Newsletter Text template

Create a template Newsletter Text with the following fields: Message Title and Message Text.

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb7

Add standard values for the Message Title and Message Text fields.

Add Newsletter Text folder to the Branche Template

Go to the Basic Newletter branche template and create a folder Newsletter Text. Assign the Newsletter Text template as Insert option.

Create Newsletter Text rendering

Create a new layout called Newsletter Text and copy the following code.



<div class="subitem-overview" style="min-height:20px">
<xsl:for-each select="./item">
<b><sc:text field="Message Title"/></b><br/>
<sc:text field="Message Text"/>
<hr/>
</xsl:for-each>
</div>


Update the Newsletter Text Rendering properties

Go to the content tab of the Newsletter Text rendering and add the Insert button to the Page editor Buttons field.

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb11

Select the ID source parameter template for the Parameter Template field to;
templates/Modules/Email Campaign/ID Source Based Parameters

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb21

Add the Newsletter Text rendering to the branche template

Open the Basic Newsletter branch template and add the Newsletter Text rendering to the email-content placeholder of the $name template and Basic Newsletter template. Change for both of the renderings the datasource field to the Newsletter Text folder (/sitecore/templates/Branches/Modules/Email Campaign/Messages/Newsletter/Basic Newsletter/$name/Basic Newsletter/Newsletter Text).

Create a Basic Newsletter

Go to ECM and create a new Newsletter based on the Basic Newsletter template. The Branche template will generate the following tree structure:

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb32

And the preview will look something like this:

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb42

Click the Edit button to open the page editor. From the page editor we can add Newsletter Text items by selecting the Newsletter Text rendering and clicking the insert button (green cross) in the floating toolbar.

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb51

After clicking the insert button the insert dialog will appear where you can select the Newsletter text template configured in the insert options of the Newsletter Text folder in the branch template. Create a new item called Newsletter text item 1. Save and close the page editor and return to ECM preview. The preview should look like this:

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb61

You can see that the Newsletter text item 1 is created in the Newsletter Text folder.

Sitecore ECM: How to create a e mail template from Scratch – Part II image thumb71

If you preferred to use the content editor you can add new Newsletter Text items in the folder. This will also work for Sitecore 6.3 and lower.

At this point the Basic Newletter template is a bit more advance. Start adding some styling and build some more controls. Take a look at the default Newsletter Message template for idea’s and examples.

Special thanks to André van ‘t Hoog of Evident for his review on the articles.

Enjoy,
Pieter

Series Navigation<< Sitecore ECM: How to create a e-mail template from Scratch – Part ISitecore ECM: How to extend personalization >>

Tags: , , , , ,

About the Author

About the Author: Pieter is Technical Marketing Manager for Sitecore Netherlands and owner of Gaatverweg.nl. He has more than ten years experience with software developing in multiple programming languages and with different Content Management Systems. Before joining Sitecore Pieter was a lead developer for multiple Sitecore and .Net projects, he joined Sitecore in 2011 as an Solution Architect in The Netherlands, after two years as an Solution Architect he joined the Technical Marketing department. In the role as Techinical Marketing Manager he is responsible for the Global MVP program and the Sitecore technical branding strategy. You can follow Pieter on twitter: @pieterbrink123 or Google+ .

Subscribe

If you enjoyed this article, subscribe now to receive more just like it.

There Are 5 Brilliant Comments

Trackback URL | Comments RSS Feed

  1. Hi Peter,

    I came across an old post of yours about adding a custom command to a visual studio context menu.
    Well Im trying to achieve the same goal but with some difficulties.
    1. I find that ‘to the point’ documentation is hard to find
    2. Several samples available fail to mention where you get some key information like the name of the existing context menus
    3. Code samples not always work depending on VS 2010 edition

    I was wondering, since you spent some time working on it in the past if you could give me a small to the point reusable code sample that creates a new custom command in the solution context menu, and in the project context menu, and in the project item context menu.

    I’ve been working on this for 2 days and i am still far from my original goal.

    Many thanks in advance

    • pieter says:

      Hi Ricardo,

      This is a long time ago. Can’t really tell you where and how I found the information (probably MSDN). At this point I’m not using the plugin anymore and removed the sollution. So I’m not able to send you a working code example.

      Goodluck creating the plugin-in,
      Pieter

  2. Hi Peter,

    really nice tutorial.

    I ask myself what the ” ID source parameter template” is used for and what effects on the renderings are applied by this template. Is this a neccessary template? I did not use this in my ECM templates at the moment.

    BR, Elmar

Post a Comment

Your email address will not be published. Required fields are marked *

Top