Create display templates to customize the appearance of Enterprise Library Viewer.
- Create the template
- Add custom styles
- Add custom scripts
Create the template
To create a display template, you need to create a file with the extension .jsp
, or .htm
. The template file should be encoded in UTF-8 (Unicode Transformation Format, 8–bit encoding form). This file should contain HTML fragments that render each interface item in the ECM library. You can use the following three custom attributes in your HTML:
The attribute is of the form entry/<tag>[@attribute]
is the name of an ATOM tag inside the entry
tag (for example, link
), and will retrieve the contents of that tag. Optionally, you may add @attribute
, which will get the value of that tag's "attribute" attribute. The parsing engine will retrieve the value you requested. For example,
<div id = "myDiv" bindField = "entry/summary"></div>
will populate the div
with the contents of the current entry's summary tag.
The syntax is similar to the bindField
syntax, and is of the form attr1:entry/tag[@attr]
. The parser retrieves the value from the current entry
, but rather than populate the tag's contents with this data, places it in the attr1
attribute of the template's tag. For example, to create a link to a document's summary URL, you will use
<a id="link" href="" bindAttribute="href:entry/link@href"><span id="linktext" bindField="entry/title"></span></a>
After creating the display template, place it in the templates/ directory
of the portlet application, for example, C:\\IBM\\Quickr\\PortalServer\\installedApps\\node_name\\PA_QuickrLibraryViewer\\qkrlibvwr.war\\templates
. Where node_name
is the name of the node, such as QK08W3NODE1
If you base your custom template on an existing template provided by IBM, you must make sure to copy the script and style files as well.
Add custom styles
To use custom styles with your display template, create a file with the same name as the template file in the templates/styles
directory. It must have .css
as its extension.
Add custom scripts
To use custom scripts with your display template, create a file with the same name as the template file in the templates/scripts
directory. It must have .js
as its extension.
Parent topic: Enterprise Library Viewer: qp85