NPSOBJ Parameters for Automatically Generated Tables of Contents

Setting the Number of Entries in Tables of Contents

You can optionally determine the file with which an automatically generated table of contents begins and how many files it contains by using parameters in the NPSOBJ tag. In this way you can, for example, restrict a list of current press releases to a maximum number.

If you wish the overview to begin at the fifth file, and restrict the list to three entries, use the following code:

<npsobj list="toclist" start="5" length="3">
  ...
</npsobj>

For a negative start parameter, the start position is determined beginning from the end. start="-10" and length="3" thus has the effect that from the last ten files, the first three are included in the list. Instead of length, you can also use end to specify the index of the last element.

Using other Fields

You are not restricted to using the titles of subfiles in the entries of automatically generated table of contents. You can enter any predefined values you like and include custom fields in your table of contents. For example you can have information about the name and type of the document, the author (custom field) and the creation date displayed right on the index page:

<ul>
  <npsobj list="toclist">
    <li>
      <npsobj insertvalue="var" name="name"/>.
      <npsobj insertvalue="var" name="contentType"/><br>
      <npsobj insertvalue="var" name="Author"/><br>
      <npsobj insertvalue="var" name="lastChanged"
        format="europeanDate"/><br><br>
    </li>
  </npsobj>
</ul>

Instead of europeanDate you can enter any date format you wish (see validDateTimeOutputFormats). As examples of further fields, you have id (file ID), objClass (file format), objType (file type), title, validFrom, validUntil and version available. Please note that CMS Fiona observes upper and lower case differences for field names.

If required you can utilize custom Tcl procedures to format field values retrieved with insertvalue-var instructions. This is especially helpful if you want to include scripts in your web pages. For this purpose, use the formatter tag attribute in the following way:

<npsobj insertvalue="var" name="name" formatter="procAlias" />

As the value of formatter the alias name of a Tcl procedure must be specified. The name of this procedure must have been assigned to the alias name in the system configuration entry tclFormatterCommands. Upon export and when preview pages are generated the NPSOBJ instruction is replaced with the return value of the procedure. You can learn more about the formatter tag attribute in section npsobj_insertvalue_var.