Start page / Template development / Template syntax / System objects / #index


The system object #index is available in templates which are used by the elements of an

In other words: if an element in one of these input component types is rendered the system object is available in the referenced section or link template.

If #index is used in a template and this is rendered outside of FS_CATALOG the return is null. This will be displayed in the preview/generation log. Therefore it is recommended, before using the system object #index, to check whether it is null or not:


The system object #index determines which number the currently rendered element has in the FS_CATALOG input component or in other words: which element is rendered. Counting begins with 0.

Important The system object #index is not available for the output of an FS_CATALOG input component with a $CMS_FOR(...)$ instruction! The output of the number of sections in the input component can however also be realised in the instruction with #for.index:
$CMS_FOR(section, pt_sectionlist)$
$CMS_VALUE(#for.index + 1)$/$CMS_VALUE(pt_sectionlist.size)$: $CMS_VALUE(section)$

The return value of #index is data type Integer.

Examples of #index

Several examples of use of the instruction within templates are shown in the following. The examples are intended to clearly show the specific effect of the instruction and provide help for the template developer when creating their own templates.

Important The examples displayed here must be adjusted for use within a project! For example, variable names must be changed to the specific variable names of the project in which the instruction is to be used.

1st Example: Numbered output of sections

Definition of the FS_CATALOG input component (form):

<FS_CATALOG name="st_catalog">
<LANGINFO lang="*" label="Section list"/>
<TEMPLATES type="section">
<TEMPLATE uid="text"/>

Invocation of the input component (HTML template set):


Definition of the section template (“text”, form):

<CMS_INPUT_TEXT name="st_text">
<LANGINFO lang="*" label="Text"/>

Numbered output in the section template (HTML template set):

$CMS_IF(!#index.isNull && !#fs_catalog.size.isNull)$
$CMS_VALUE(#index + 1)$/$CMS_VALUE(#fs_catalog.size)$:

Apart from the value of the text input component the example also outputs the index (increased by one) and the total number of sections (e.g. “1/3”).


1/3: 1st Section
2/3: 2nd Section
3/3: 3rd Section

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.4 | Data privacy