Extended Template Language

Improved Editing Elements in the Preview

Editing elements (markers) in the preview can now be positioned dynamically and enhanced with effects. These markers will no longer corrupt the layout since they float on top of the content to be edited.

Editingelement

Better @ References

Now @ references can not only be placed at the beginning of an attribute value but anywhere inside the value. Furthermore, attribute values can now contain any number of @ references. As a result, attribute values can be constructed from static or dynamically generated text, or both. This became possible by a new syntax. @ references now have the format @{variable} instead of @variable.

Previously, layout developers proceeded as follows to assign a combination of static and dynamic text to attribute values:

<!-- Previously used method -->
<npsobj modifyvar="set"
  varname="cssClass">box obj_<npsobj insertvalue="var" name="id"/></npsobj>
<div class="@cssClass">

By using the new @ references, the same effect can be achieved much easier:

<!-- New method -->
<div class="box obj_@{id}">

With the new @ references, the field or variable name is always enclosed in braces. The previous form is no longer supported.

When migrating, @ references that have the previous format and are contained in layouts and HTML documents are automatically converted to the new format.

Local Export Variables

In the modifyvar set NPSOBJ instruction, export variables can now be marked as local. An example:

<npsobj modifyvar="set" varname="foo" local="true">bar</npsobj>

The attribute local is also available in modifyvar append instructions. However, with this instruction, a variable only becomes a local variable if it does not already exist as a global variable. In other words: global variables remain global even if local has been specified.

In conjunction with parameterized calls to layouts, local variables help to better separate sublayouts from the layouts calling them. This makes the layout structure clearer and, as a consequence, easier to maintain.

Parameterizable Layouts

When calling (including) a layout by means of an insertvalue template instruction, a static or dynamically generated text can be passed to it. For this, the text can be placed into the content of the insertvalue template instruction. In the layout called, the text can be retrieved by querying the local variable npsobjContent. For an example, please refer to the description of the insertvalue template instruction.

This new functionality makes it possible to use layouts in different contexts without the need to define global variables for passing arguments to them. This reduces the complexity of layout files.

Furthermore, pure textual data can be passed to a layout as arguments using tag attributes. An example:

<npsobj insertvalue="template" name="TemplateName" showbody="1" person="@{author}" />

The arguments as well as the npsobjContent variable are treated like local export variables. They are only available while the included layout is evaluated and are only accessible by this layout. For an example and further explanations, please refer to the documentation of the insertvalue template instruction.