#cs
The system object: #cs is available in table templates. Table templates can be used as data source-based sections in a page of the Page Store. In the output of the section in a preview or generation, #cs provides information on the current data source-based sub-page (cf. also Multiple pages) and on the current data record. As a result it is possible, among other things, to determine whether the current data record is the first or the last of the sub-page, how many data records are displayed, etc.
The following methods can be applied to #cs .
Invocation | Description | Return data type |
---|---|---|
#cs.contentLength | Determines how many data records are displayed on the current sub-page of the multiple page. The counting begins with 1. | |
#cs.contentPosition | Returns the index of the sub-page in the multiple page. The counting begins with 0. | |
#cs.currentRowNumber | Returns the number of the current data record in the sub-page. | |
#cs.isEvenContentRow | Determines whether the number of the current data record in the sub-page is even. | Boolean |
#cs.isFirstContentRow | Determines whether the current data record is the first in the sub-page of the multiple page. | Boolean |
#cs.isLastContentRow | Determines whether the current data record is the last in the sub-page of the multiple page. | Boolean |
#cs.isOddContentRow | Determines whether the number of the current data record in the sub-page is odd. | Boolean |
Examples of #cs
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.
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 data records
$CMS_IF(#cs.isFirstContentRow)$
<table>
$CMS_END_IF$
<tr>
<td>$CMS_VALUE(#cs.currentRowNumber + 1)$/$CMS_VALUE(#cs.contentLength)$</td>
</tr>
$CMS_IF(#cs.isLastContentRow)$
</table>
$CMS_END_IF$
The example outputs, for a sub-page of a multiple page, which data record of how many data records in total is output. In addition, for the first data record on the sub-page an opening table tag is output and for the last a closing tag.
Exemplary output:
1/3
2/3
3/3