npsobj insertvalue dynamiclink

Syntax

npsobj_insertvalue_dynamiclink::=

  <npsobj insertvalue = "dynamiclink"
    destination = "destination"
    [ formatter = "formatter_procedure_alias" ]
    {other_attribute} />

other_attribute::= string = "string"

Task

The purpose of the element is to generate include instructions in the syntax of any scripting language (PHP, JSP, SSI) and have the reference maintained by the automatic link management. Due to its impact on performance, the element should only be used for the purpose for which it was designed – the server-side inclusion of files – and not for calculating relative paths. For the latter a formatter in an insertvalue var instruction or a systemexecute instruction is sufficient. Dynamic links only work in the dynamic preview.

The type of the generated link is dynamic.

The attributes have the following meaning:

  • If formatter has been specified, the Tcl procedure with the alias formatter_procedure_alias defined in the export.tclDynamicLinkFormatterCommands system configuration entry is executed. The return value of this procedure is inserted into the exported page in place of the complete NPSOBJ instruction. If formatter has not been specified, destination is inserted in place of the instruction.

  • Using destination, the path or the URL to be processed by the formatting procedure is specified. destination can be a relative or an absolute path or an URL. Paths are transferred to the link management as internal, URLs as external links.

  • Additional attributes can be specified as other_attribute.

Since the referenced file can be included by any file in the live server directory hierarchy and might itself contain links, the Content Manager and the Template Engine can be configured to generate absolute internal paths and URLs (inside the file concerned) using the export.exportAbsolutePaths system configuration entry. If this entry is set to YES, the prefixes for absolute paths and URLs are used. These prefixes can also be configured by means of the export entry.

The following arguments are passed to the formatting procedure in the given order:

  • The URL of the destination, i. e. of the CMS file path, including the URL prefix, if applicable;
  • the file system path of the destination, including the file system prefix, if applicable;
  • the ID of the exported file;
  • a list containing all other_attribute attributes and their values as name-value pairs.

Example

The following instruction creates a PHP-include instruction in the exported file. This inclusion references the file with the path ../some/path. A link to the referenced file is created and taken into the link management. If – in the case of references to CMS files – the referenced file is moved, the link and the NPSOBJ instruction are automatically adapted.

<npsobj insertvalue="dynamicLink" destination="../some/path" formatter="phpInclude" />

The instruction returns the following PHP instruction:

<? include("/from/root/to/some/path"); ?>