Data templates

Abstract

Overview of data templates.

A data template (also known as a data template definition item) defines a data type. Sitecore associates a data template with each item in the Sitecore content tree. It is the data template that defines the structure of all the items associated with that data template. A data template contains sections, each of which contains fields. The data template sections organize data template fields visually in editing user interfaces, and the data template fields define the structure of items based on that data template.

Sitecore represents data templates as hierarchies of definition items. The root item defines the template, each child defines a field section, and each grandchild defines a field.

Hierarchy of the product item showing a field section and fields

In this example, you can see the Product data template opened with its field section Data immediately below it, and underneath this field section you can see the fields Title, Description, and Price. These correspond to the sections and fields that you see if you edit an item associated with this data template. The following image shows the standard values item for the Product data template, which is an item based on (associated with) that data template.

_Standard Values Content tab

In object-oriented programming, a data template is similar to a class, where data template fields are like properties of that class. In relational database programming, a data template is similar to a table, where data template fields are like columns in that table.

Each data template inherits its sections and fields from its base templates and Sitecore combines the sections and fields in the data template and all its base templates. It is important to note that:

  • Data templates support sequential and multiple inheritance.

  • Most data templates inherit from the Sitecore standard template, which defines fields common to all items.

  • Changes to a data template appear immediately in all items based on that data template or all items that inherit from that data template.