A template defines the properties of a content item and also the interface that enables a content administrator to configure the properties.

You define properties within the <ContentItem> element in the template. For each property, you specify a name and a property type. You can optionally specify a default value for a property.

You associate editors with properties to enable the content administrator to configure their values within Experience Manager. Properties are generally primitive types such as Strings, Booleans, or Lists. Another type of property is a section, which allows content administrators to insert and configure another content item.

You can choose not to expose a particular property in Experience Manager and simply specify a default value to pass to the Assembler and ultimately to the client application. This is useful for values that do not need to be configured by the content administrator, but are needed by the Assembler for content processing or by the client application to determine how to render the content.

You can define the properties of a content item by nesting any number of <Property> elements within the <ContentItem> element.

Cartridge properties are typically used for one of the following purposes:

Each property must have a name that is unique within the template. If the property is to be passed through directly to the renderer, this can be any name that makes sense for your application. However, some properties are part of the configuration model for the cartridge. In this case the associated cartridge handler depends on the presence of specific properties in the template.

The property name is specified in the name attribute of the <Property> element.

You specify the property type by adding a child element of <Property>. Properties can be one of two kinds:

After you have defined the content properties in your template, you can define how those properties can be configured by the content administrator in Experience Manager.

You add content editors inside the <EditorPanel> element in the template. The <BasicContentItemEditor> element enables you to specify individual property editors that display in Experience Manager and associate them with a particular property.

For example, this excerpt from a sample template defines a configurable string property named title:

<ContentTemplate xmlns="http://endeca.com/schema/content-template/2008" xmlns:editors="editors" 
                 type="ResultsPage">
  <!-- additional elements deleted from this example -->
  <ContentItem>
    <Name>Three-Column Navigation Page</Name>
    <!-- First define the content property -->
    <Property name="title">
      <String>Discover Electronics</String>
    </Property>
    <!-- additional properties deleted from this example -->
  </ContentItem>
  <EditorPanel>
    <BasicContentItemEditor>
      <!-- Define an editor for each property that should 
           be configurable -->
      <StringEditor propertyName="title" label="Title"/>
      <!-- additional editors deleted from this example -->
    </BasicContentItemEditor>
  </EditorPanel>
</ContentTemplate>

Editors are defined in templates with the editors namespace. By convention, the propertyName is a required attribute and specifies the property that this editor is associated with. The property must be defined in the <ContentItem> part of the template, and must be of the appropriate type for that editor. For example, an <editors:StringEditor> cannot be associated with a <xavia:List> property. If you define a content editor for a property that does not exist, or that is of the wrong type, a warning displays in Experience Manager when a content administrator attempts to configure the content.

Property editors do not have to be defined in the same order as the properties in the template. The <BasicContentItemEditor> renders the editors in a vertical layout in Experience Manager, in the order in which you define them in the template. If you do not want a property to be exposed in the Experience Manager interface, do not define an editor associated with it.

It is possible to create more than one editor associated with the same property. However, be aware that all editors that you define in the template are displayed in Experience Manager, which may be confusing to the content administrator. When the value of a property is changed, any other editors associated with that property are instantly updated with the new value.


Copyright © Legal Notices