The Function of Layout Files

Layouts serve to efficiently realize a website with a homogenous design. Frequently used elements such as logos and navigation elements need only be set up once in a layout and can then be used for all files in the folder hierarchy located at or below the level of the layout in the hierarchy.

For exporting every file of the folder or document type (to whose file extension the text/html MIME type has been assigned) the Content Manager and the Template Engine use a layout file as the base layout. Also, when exporting a file only its released content is considered. Which layout file is used depends on the defaultTemplate user preference in the Content Manager, while in the Template Engine the defaultTemplate system configuration entry determines the name of the base layout file. Being able to configure the base layout file to be used for exports makes it possible to maintain several layouts at the same time. A layout can be activated spontaneously and as desired by making the relevant layout file the base layout prior to the export.

The base layout file is processed like a program. The resulting website is created by processing this program for every released file exactly once. Every time the program is processed, particular instructions in the base layout relate to the file currently being exported. Of course you can use not only these instructions, but also standard HTML-tags in layouts.

You can use instructions in a layout such as the base layout to access the field values of the file currently being exported, in order to create meta tags, links and other HTML elements from them. Furthermore, instructions are available with which you can have tables of contents (link lists), a micronavigation, sitemaps or other link structures automatically generated.

The instructions are introduced with the keyword NPSOBJ, which is used in the same way as an HTML tag. When processing the base layout file the Content Management Server and the Template Engine evaluate the NPSOBJ tag to a string, which is then written into the output file in place of the entire NPSOBJ tag. For example, the following instruction is replaced with the value of the custom field named abstract. This value is thus inserted into the generated web page:

<NPSOBJ insertvalue="var" name="abstract">

Fundamentally, the base layout is simply a special layout file which can function as initial layout upon export because of the instructions it contains. Besides the base layout you can use as many other layouts as you wish to give your website or subpages a homogenous layout.

Using an NPSOBJ instruction it is possible within a layout to use other layouts or the same layout. For example, from a base layout you can call respective layouts for creating the navigation elements at the head and foot of a page, keeping the base layout as general as possible and thus making it universally applicable. All the layouts used during an export, are called a layout set.

The way in which your layouts work can be checked at any time with the preview function.

Main Content layouts

A main content layout is a layout file referenced in a file format (see Defining File Formats). Upon export and when a preview page is generated it formats the main content of every file based on this format. Main Content layouts serve to define and to consequently standardize the appearance of documents. Therefore, a main content can be modified neither with an editor in the HTML user interface nor with Tcl commands if a main content layout has been specified in the file format of the relevant file. In this case, it is also not possible to import the main content from a file.

Main Content layouts are especially suitable for generating uniform documents like data sheets or product specifications. Such documents are primarily made up of field values that can be arranged and styled according to your wishes by means of a main content layout.

The main content layout used for exporting released contents or displaying them in the preview is stored directly in the contents as they are released. It is therefore necessary to release the files concerned again after a (different) main content layout has been assigned to the file format or the main content layout has been removed from it. This also applies when the main content layout itself has been modified. Draft versions, however, are affected immediately after changes have been made to the main content layout.

Please note, that when main content layouts are used on an incrementally exported live server, all files directly or indirectly referencing a main content layout must be located in the same hierarchy branch as the layout and on the same or a subordinate hierarchy level. Otherwise, the referencing files are not re-exported when the layout is updated.