Template-related contexts
This page describes the differences that exist regarding the availability of variables, if they are defined on the form or on the presentation channel tab of a template.
At first, only exemplary variables in a template are considered, detached from their relationship to other templates and other FirstSpirit objects. In the project context, the availability of variables, which are defined in templates, can differ (see Project-related contexts page). |
Availability of variables within a template
In templates (e.g. section templates), variables
- which are defined on the Form tab are available to the entire instance of the template (e.g. to an entire section in the Page Store, which is based on this template),
- which are defined on a Presentation Channel tab are available to the instance of the template (e.g. to an entire section in the Page Store, which is based on this template) from the value assignment.
On the other hand, the value, which is assigned to a variable,
- which is defined on the Form tab, is only available to the respective instance of the template (e.g. to an entire section in the Page Store, which is based on this template),
- which is defined on a Presentation Channel tab, to all instances (e.g. all sections), which are based on this template (however, also not until after the value assignment).
See also Defining variables via templates.
Here an instance always refers to the use of a template (page, section, table, format, link template) in the Page or Content Store or in the Global Content Areas.
Variable definition on form or presentation channel tab?
In the normal case, in each instance of a template (i.e. each individual section or each individual page) the variable values are assigned by the editor, the relevant variable is defined on the Form tab. These values are then normally only available in the same instance.
If a value is to be available in several pages or sections (instances) and therefore be more universal,
- the corresponding variable must be defined on the Output tab
- or in a so-called "higher context" (see Reuse and inheritance).
On the other hand, the type of value assignment also plays a role: the editor assigns values to variables on the From tab, variables on the presentation channel tabs of the template developer (see also Value assignment).
However, the editor can also be allowed to affect the values set by the template developer, for example, if an input component is used with the same variable name so that the value set by the template developer can be overwritten (see also Overwriting variables).
Summary
Variable definition on | Variable definition on | |
---|---|---|
Value assignment | values are primarily assigned by the editor | values are primarily assigned by the template developer |
Validity for one instance | a variable is valid for the entire instance of a template | a variable is only valid within the instance of the template from the point in the code at which it is defined |
Validity for all instances | a variable is not valid for all instances based on the template, but only for one | a variable is valid for all instances based on the template |