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.

image

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">

<b></b><br />

<hr />

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

image

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

image

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:

image

And the preview will look something like this:

image

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.

image

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:

image

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

image

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

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

  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

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

Leave a Reply

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