Skip to main content
Skip table of contents

composeContentParts

Evaluates the content commands in the specified parts of a document template. This is a variant of composeContent with this difference of leaving some parts of the document template unevaluated.

The decision of which elements in the template content can have their content commands evaluated is done through the attributes select and ignore. Both attributes - out of which only one can be be defined - accept a String with CSS-like id and class selectors. The elements with the defined ids or classes (and all their descendant elements) are then either composed or not composed, depending on which attribute was used, with the opposite happening to all other content.

The template attribute defines the document content to evaluate. There are three types of valid resolved values for this attribute:

  • A DAP Part causes the content of that Document or Email part to be evaluated. Use the DocumentProperties variable doc to get the Part you need. For example:${doc["Body Content"]}

  • A String value should be a path pointing to a HTML document within the template's archive file - this is the document whose content is evaluated. For example:"Cover Page/content.html"

  • A File value. The file may be an HTML template, whose content is then evaluated.

The result of the evaluation will be a File value. The name of the file in the case of Online templates' HTML documents will be the title of the document.

var

String

Defines the name of the variable placed into the variable context whose value is the evaluated HTML document.

template

DAP Part, File, String

Defines the template out of which the evaluated content is picked. The resolved value may be a DAP Part, a String or a File, as described in this command's documentation.

select

String

This attribute defines which parts of the template are composed. The resolved value is expected to be a String containing one or more CSS-like class and id selectors, separated by a space.

Any elements in the template that match the selectors are composed, including their descendant elements. The rest of the template's content will remain uncomposed.

It is required to define a value for either select or ignore. Having both be undefined is an error. If both are defined, select takes priority.

ignore

String

This attribute defines which parts of the template are not composed. The resolved value is expected to be a String containing one or more CSS-like class and id selectors, separated by a space.

Any elements in the template that match the selectors are not composed, including their descendant elements. The rest of the template's content will be composed.

It is required to define a value for either select or ignore. Having both be undefined is an error. If both are defined, select takes priority.

editable

Boolean

If this attribute resolves into false, any HTML content commands that are capable of making their contents editable will not do so, regardless of their own attribute values. This may also affect other behavior of HTML content commands, which will then be mentioned in their documentation.

The resolved value of this attribute is available to all the evaluated content commands with the variable name "composeContent_editable".

Default value is true.

The composeContentParts command is the tool to use instead of composeContent, should there be a need to have some content commands in the document not be evaluated.

To illustrate the basics of how this command works, here is a simple HTML structure with some content commands in it:

CODE
      <div id="first" class="odd-block">
        <span id="first-inline" dyn-content="1 + 1">
          The first example block, unevaluated.
        </span>
      </div>
      <div id="second" class="even-block">
        <span id="second-inline" dyn-content="2 + 2">
          The second example block, unevaluated.
        </span>
      </div>
      <div id="third" class="odd-block">
        <span dyn-content="3 + 3">
          The third example block, unevaluated.
        </span>
      </div>
    

If we'd like to compose only the div elements with the "odd-block" class, setting the select attribute does the task. Note that since "odd-block" is a class, it is prefixed with a dot:

CODE
<composeContentParts var="composedParts" template="doc['Document']" select=".odd-block">

And the result produced by the command would look like this:

CODE
      <div id="first" class="odd-block">
        <span id="first-inline">
          2
        </span>
      </div>
      <div id="second" class="even-block">
        <span id="second-inline" dyn-content="2 + 2">
          The second example block, unevaluated.
        </span>
      </div>
      <div id="third" class="odd-block">
        <span>
          9
        </span>
      </div>
      

The ignore attribute works in the opposite way, with the selector defining what is not composed. If the div element with the id "third" should remain uncomposed, the id should be given to the ignore attribute prefixed with a hash:

CODE
<composeContentParts var="composedParts" template="doc['Document']" ignore="#third">

And the result would look like this:

CODE
      <div id="first" class="odd-block">
        <span id="first-inline">
          2
        </span>
      </div>
      <div id="second" class="even-block">
        <span id="second-inline">
          4
        </span>
      </div>
      <div id="third" class="odd-block">
        <span dyn-content="3 + 3">
          The third example block, unevaluated.
        </span>
      </div>
    

You can also have multiple selectors in either attribute value space-separated like this:

CODE
<composeContentParts var="composedParts" template="doc['Document']" ignore="#first-inline .even-block">
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.