npsobj insertvalue var

Syntax

npsobj_insertvalue_var ::=

  <npsobj insertvalue = "var" name = "name"
    [ format = "format_name" ]
    [ formatter = "formatter_procedure_alias" ]
    [ separator = "separator" ]  />

Task

The NPSOBJ instruction is replaced with a field value or the value of an export variable. The value is determined by making a query in the current context for the string value of name with the format format_name and the separator separator. If specified, the separator is used to separate the elements of a Multiple selection type field from each other.

The format format_name will only be used if the value of name has the date type. It refers to one of the named date and time formats defined in the validDateTimeOutputFormats system configuration entry.

By using the formatter tag attribute, the value of name can be formatted using a Tcl procedure.

Example

Output the title of the exported file:

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

The following instruction generates a variable definition in the language PHP. For this to work, phpVardef must be the alias of a procedure that generates the corresponding PHP code.

<npsobj insertvalue="var" name="title" formatter="phpVardef" />

The phpVardef procedure is already included as a server command in the serverCmds/formatter.tcl file. When the procedure is called by the NPSOBJ instruction shown above the following output will be generated:

<?php $title = "Title of the current file"; ?>