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:
The property values may be intended to be used directly by the client application. For example, the content administrator may be able to enter text to use a heading or link text, or she may supply a URL to an image. Property values can also contain information such as meta keywords that are part of the page but do not affect its display.
The values may be intended for the relevant cartridge handler in the assembler to use for processing, for example, parameters for a query to the MDEX Engine (or another external resource) to return the actual content that the application should display.
Occasionally, a cartridge has no properties (and therefore no configuration options in Experience Manager), but exists only as a placeholder to indicate that a certain functional component should be included on a page. The Assembler inserts the necessary information for this cartridge at query time.
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.
Note
The
name
attribute is defined as type
xs:Name
in the template schema. This means that valid
values for these attributes must:
Numbers are allowed as long as they do not appear at the beginning of the string.
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.
Related links
You can configure default values for Experience Manager editors across the entire application by modifying the editor configuration file, or on a per-template basis by modifying cartridge templates directly.
You can configure Experience Manager editors through the following methods:
You can configure editors in the editor configuration file,
editors.xml
. This configuration applies to all instances of a specific editor within an application.You can configure editors within a cartridge template. This configuration applies to all instances of a specific editor created based on that template. In the case of shared properties, configuration in the cartridge template overrides configuration in
editors.xml
.
For details about configuring the core editors packaged with Oracle Commerce Tools and Frameworks, see the "Template Property and Editor Reference" Appendix.
You can modify the editor configuration file to set configuration that is common to all instances of a specific editor within an application. This can include basic values for the editor, or information used to communicate with an external resource.
Note
Oracle recommends configuring a data service for cases where different editors all need to access a common set of configuration for an external resource.
To add configuration information to the editor configuration file:
Navigate to the editor configuration file at
<app dir>\config\import\configuration\tools\xmgr\editors.xml
.Insert an
<EditorConfig>
element directly inside the<Editor>
tag of the editor you wish to modify.Add your arbitrary configuration information.
The example below includes the configuration inside a nested element, but you can also specify the information as attributes of the
EditorConfig
element:<Editor name="editors:MyEditor"> <EditorConfig> <Arbitrary foo="bar" size="10" resizeable="false"/> </EditorConfig> </Editor>
Run the
set_editors_config
script to publish your changes to the Endeca Configuration Repository.