Share via


What Are Display Templates?

Display templates let you display variable advertising and discount content on your Web site. They contain a mix of HTML and display template properties that are replaced with user-defined values.

You can define display templates by using the DisplayTemplate object. For a code example, see How to Create a Display Template. Display templates cannot be defined through the Marketing Manager.

You can attach DisplayTemplate objects to Advertisement and Discount objects in your code by using the TemplateName property.

Display templates can be linked to advertisements and discounts in the Marketing Manager UI through the Display Type Properties Page.

On the run-time Web site, the ContentSelector object uses the CSFFormatTemplate pipeline component to customize the DisplayTemplate object associated with an Advertisement or Discount object.

What are the Display Template Properties?

Display template properties are tokens associated with display templates that enable you to customize the template for the specific Advertisement or Discount object.

The Text property of the DisplayTemplate object contains HTML markup with an embedded Label control that can be replaced with dynamic values at run time by using Value within the Advertisement or Discount object or by using DefaultValue within the template DisplayProperty. Embedded display properties are defined within the Text property starting with the "{%" characters and ending with the "%}" characters. For example, if the following HTML markup is included as part of the Text property, the AltText and ImageSource properties are treated by the marketing system as variable display properties:

<img alt="{%AltText%}" src="{%ImageSource%}">

If you replace the AltText display property with "This is alternate text displayed for non-image capable browsers" and the ImageSource display property with "https://localhost/yoursite/images/logo.gif" in the DisplayPropertyValue object, the output appear as the following:

<img alt="This is alternate text displayed for non-image capable browsers" src="https://localhost/yoursite/images/logo.gif">

See Also

Other Resources

Display Templates