Start page
Start page
Start page

Start page / Template development / Variables / Contexts

Contexts

As described previously, variables can be defined in various places within FirstSpirit. Precisely where a specific variable should be defined depends on the requirements of the respective project and the use case.

Variables are available within FirstSpirit objects. Each FirstSpirit object has a so-called context. This context can be used to describe and influence the properties of the respective object. Depending on the type, a FirstSpirit object can contain other FirstSpirit objects, e.g. a page of the Page Store can contain sections, a section can contain other sections or data sets (e.g. with the help of FS_LIST) etc. In general, a new context is opened in an "outer" object by means of an "inner" object. This brings about a hierarchical arrangement of contexts. Each inner FirstSpirit object inherits the context information of the outer objects.

A context only exists in conjunction with the object. Against the background of the generation, in which the individual FirstSpirit objects are evaluated and resolved in the order defined by the project, the objects have a certain lifespan. The lifespan of the context also ends when the lifespan of an object ends; the context is "closed" again. The context data is then no longer available to objects on the same hierarchical level.

Variables are part of the context information and can therefore affect the behavior of the object. This also means that variables are transferred from outer to inner objects by default, and are also by default only available as long as the context or the object. If necessary they can, however, be placed in "higher" contexts so that their life is lengthened. The advantage of a variable that has a longer lifespan is that it can be accessed in many places within the project, however, this also means that name conflicts are more likely to occur.

In the following, the availability of variables within templates (separated from the project context) are described first, then the availability of variables project-wide. Finally, several special variable properties are described.

© 2005 - 2012 e-Spirit AG | All rights reserved. | Last change: 23.04.2012