HTML Main Content and other Field Values

You can access the main content of the exported file exactly as you access every other field. Field values are read out with an NPSOBJ tag in accordance with the following example:

<npsobj name="field-name" insertvalue="var"/>

In this it is unimportant whether you are accessing file fields (like name), built-in version fields (like lastChanged or title) or custom version fields.

You can insert the main content (usually in a layout referenced by the base layout) into the resulting output file using the following instruction:</p>

<body>
  <npsobj name="body" insertvalue="var"/>
</body>

Please note that it is not possible to set the value of an HTML tag attribute using an NPSOBJ instruction, for example in the following manner:

<!-- This is illegal -->
<A href="/" title="<npsobj insertvalue="var" name="myField"/>">
Click here</A>

For this purpose, please use an @ reference or a formatter that generates the complete HTML element (see npsobj_insertvalue_var).

Please also note that NPSOBJ instructions are only evaluated if they are contained in the main content of layout files, documents and folders and if, additionally, the MIME type of these files is text/html.

Furthermore, the exported pages (i. e. the layouts as well as the fields included into them) which are delivered via the Portal Manager must not contain Velocity code since the Portal Manager evaluates this code which might cause the page to be corrupted or not displayed at all. If you wish to insert Velocity code into a page, replace all # characters with &#x23; and all $ characters with &#x24;.

The following table contains a selection of the file and content fields available. The full extent of the language is listed in the syntax reference. Please note that the spelling of a field name in an NPSOBJ tag must correspond exactly to the actual spelling of the field name – upper and lower case is also observed.

Field nameField value
body The main content of the released version of the exported file.
contentType The file name extension.
id The file ID.
name The file name.
path The file’s current path.
prefixPath If the current file is a folder, then the path followed by the character "/” is returned, otherwise the path is returned.
title The current file’s title.
visibleName If the current file is a document, the file name is returned followed by the file name extension. If it is a folder, only the file name is returned.
visiblePath For documents this is the complete path including the file name with which the file is exported. For folders it is the complete path including the file name, followed by "/index", followed by the folder’s file name extension.
lastChanged The date of the last change to the current file. Changes to the file’s content are hereby not considered. On export of a released file the last change is the release.
validFrom The date from which the file’s content is valid. This field is ignored for layouts. The value of validUntil must be empty or greater than validFrom.
validUntil The date until which the content of the file is valid. If this value is null the document’s validity is unlimited. This field is ignored for layouts.

The format in which date values are returned on export and in the preview is normally determined by the first value in the export.validDateOutputFormats system configuration entry. However, you can influence date formatting with the additional tag attribute format="formatName" in the NPSOBJ tag by specifying as formatName one of the other names defined in the system configuration entry mentioned above.

Das Format, in dem Datumswerte beim Export und in der Vorschau geliefert werden, wird normalerweise durch den ersten Wert im Systemkonfigurationseintrag export.validDateOutputFormats bestimmt. Mit dem zusätzlichen Tag-Attribut format="formatName" im NPSOBJ-Tag können Sie jedoch die Formatierung des Datums beeinflussen, indem Sie als formatName einen der anderen Formatnamen angeben, die im genannten Systemkonfigurationseintrag definiert sind.

For Multiple selection type fields whose value is made up from several elements, a string as separator must be specified as separator="string" in the NPSOBJ tag. CMS Fiona uses the separator to separate the individual elements of the field value from each other. You may specify an empty string as the separator.

The following example shows how the title of a document (built-in content field title) and a key-word list (custom content field keywords) are used as HTML meta elements, and how the date of the last change (fixed content field lastChanged) and the value of the custom field author are automatically inserted at the end of the HTML page created.

<head>
  <title><npsobj name="title" insertvalue="var"/></title>
  <npsobj name="keywords" insertvalue="meta" separator=","/>
</head>
<body>
  <npsobj name="body" insertvalue="var"/>
  <hr>
  <font size="-2">
  Last changed on
  <npsobj name="lastChanged" insertvalue="var"/>.
  Author: <npsobj name="author" insertvalue="var"/>
  </font>
</body>

HTML text can also be generated only under particular conditions, for example only on export of folders or dependent on the value of a field.