AquaLogic Interaction Development Kit (IDK) 6.0.0

Plumtree.Remote.PRC.Content.PresentationTemplate Namespace

Provides interfaces for creating, modifying, managing, and retrieving Presentation Templates. (See Content Item Examples for sample code on how to create and retrieve Presentation Templates.)

Refer to the Administrator Guide for AquaLogic Interaction Publisher for API documentation, sample template text values, and details on presentation template functionality.

Note: Presentation Template names cannot be an empty string, cannot be longer than 255 characters and are case-insensitive.

The steps below describe common interactions between different Publisher objects.
1. Create a Data Entry Template.
2. Add one or more properties to the Data Entry Template and store the template.
3. Create a Presentation Template for the Data Entry Template.
4. Attach the Presentation Template to the Data Entry Template and store the Data Entry Template.
5. Create one or more content items using the Data Entry Template.
6. Set values for properties on the content item and check in the content item.
7. Preview and publish the content item.
Note: One or more content items can be created using the same Data Entry Template; however, only one Presentation Template can be attached to a Data Entry Template.

Since IDK 5.2

Namespace hierarchy

Interfaces

InterfaceDescription
IPresentationTemplate Represents a Presentation Template in Publisher. A Presentation Template includes template text and various publishing-related attributes that define the layout of a content item when it is published.

A new Presentation Template can be created using IPresentationTemplateManager.CreatePresentationTemplate and stored permanently using Store. Any field modification of the Presentation Template will not be persisted until Store is called.

The template text in Presentation Template is used for determining the layout of a content item when published. A publishable content item needs a Presentation Template with a valid template text and the Presentation Template must be attached to the Data Entry Template of the content item.

To attach a Presentation Template to a Data Entry Template, IDataEntryTemplateManager.AttachPresentationTemplate can be used.

An example using IPresentationTemplate can be found in the documentation for IPresentationTemplateManager.

A portlet can be associated with a Presentation Template directly or indirectly:
  • 1) Directly - Associate a portlet with a Presentation Template by setting the portlet ID to the template.
  • 2) Indirectly - Associate a portlet to one of the template's containing folders by adding the portlet ID to the folder. The folder must contain either a publishable Presentation Template or a content item that has already been associated to the same portlet. The folder can be either the folder containing the template, or any parent folder of that containing folder.
  • Refer to the Administrator Guide for AquaLogic Interaction Publisher for additional details on Presentation Template and portlet association.
    IPresentationTemplateManager Interface for managing IPresentationTemplates. Handles Presentation Template creation, removal, retrieval, and template text validation.

    Modifications to the template text will not be stored permanently until IPresentationTemplate.Store is called.

    Presentation template text can contain PCS tags that conform to the Publisher Templating Language Syntax. PCS tags allow a published content item to contain data that is tied to the content item's values. However, the presentation template text need not contain PCS tags; HTML or plain text is also valid.

    PCS tags are formatted like XML elements and begin with the prefix pcs. During publication, Publisher replaces the pcs tag with the value of the expression, or the contents of the tag if the PCS tag expression fails. IPresentationTemplateManager.ValidateTemplateText can be used to check basic PCS tag syntax but the method does not guarantee proper tag evaluation at publishing time. Text outside pcs tags is left unchanged when the template is processed during publication. Tags can appear inside HTML elements, inside HTML tags, and inside quoted strings.

    The following is an example of Presentation Template text that can be used with IPresentationTemplateManager.CreatePresentationTemplate and IPresentationTemplate.TemplateText.
    <pcs:value expr="headline"></pcs:value>
    <pcs:value expr="article.author">Anonymous</pcs:value>
    <pcs:value property='writer.name'></pcs:value>
    <img src="<pcs:value expr="photo.location"></pcs:value>">
    <a href="<pcs:value property='homepage.location'></pcs:value>">
    <pcs:value expr='creation_time' format="MMMM dd"></pcs:value>">
    

    Refer to the Administrator Guide for AquaLogic Interaction Publisher for additional details on Presentation Template functionality and sample template text values.

    The following is an example of validating template text against a persisted IPresentationTemplate.
    string templateText = "No pcs tags in the initial Presentation Template.";
    IFolder rootFolder = folderManager.GetRootFolder();
    IPresentationTemplate presentationTemplate = presentationTemplateManager.CreatePresentationTemplate(rootFolder, "New Presentation Template", templateText);
    // Persist the presentationTemplate
    presentationTemplate.Store();
    string[] errorsInText = presentationTemplateManager.ValidateTemplateText(presentationTemplate, presentationTemplate.TemplateText);
    if(errorsInText.Length != 0)
    {
     // Correct errors in the Presentation Template text
    }
    else
    {
     // No errors were found
    }
    string updatedTemplateText = "<a href=\"<pcs:value property=\'homepage.location\'></pcs:value>\">";
    errorsInText = presentationTemplateManager.ValidateTemplateText(presentationTemplate, updatedTemplateText);
    // Repeat the above check of the String[] errorsInText
    // to determine if the updatedTemplateText contained errors
    presentationTemplate.TemplateText = updatedTemplateText;
    // Persist the presentationTemplate with the new template text
    presentationTemplate.Store();
    
    IPublishablePresentationTemplateManager Interface for managing IPresentationTemplates that do not have an associated IDataEntryTemplate and can be published standalone (without a content item). When used with IPublishablePresentationTemplateManager, the IPresentationTemplates template text represents static content, usually HTML. Because there is no Data Entry Template nor content item associated with a publishable Presentation Template, PCS tags in the template text are not replaced at publishing time.

    The following example demonstrates publishing a Presentation Template.

    string templateText = "<HTML><BODY>This is static HTML content.</BODY></HTML>";
    IPresentationTemplate presentationTemplate = publishablePTManager.CreatePresentationTemplate(
      containingFolder, "Publishable Presentation Template", templateText);
    presentationTemplate.Store();
    // If the IPresentationTemplate was attached to an IDataEntryTemplate it would not be publishable.
    if(presentationTemplate.Publishable)
    {
      publishablePTManager.PublishPresentationTemplate(presentationTemplate);
      // Retrieve the URL via: presentationTemplate.PublishURL;
    }