Parameterizing npspm Elements

All npspm instructions used in the layout files of the Content Management server except showIfLoggedIn can be parameterized. It might be necessary to do this in layout files, in which npspm elements are used for the elements of a list which is generated only at runtime (a toclist or a list of free links). Parameterizing the npspm instructions means using variables in place of known fields of the exported file. Thus, the access permission of the files determined by the list instruction can be checked:

<npsobj list="toclist">
  <npspm showIfAccessible="@self"> ... </npspm>
</npsobj>

To write HTML text (oder other text) to the output file only if a user is a member of at least one of several user groups, the following npspm instruction can be used:

<npspm showIfMember="@memberList"> ... </npspm>

In the example above, memberList represents a multi-selection field that contains group names. As described in showIfMember, the group names may also be specified directly using the vertical bar character as a separator. This is the full sample code with which a list containing permission checks for each element can be generated:

<ul>
  <npsobj list="toclist">
    <npspm showIfMember="@memberList">
      <li>
        <npsobj insertvalue="anchor" name="self">
          <npsobj insertvalue="var" name="title" />
        </npsobj>
      </li>
    </npspm>
  </npsobj>
</ul>

The generated list contains only elements the user is permitted to access.