#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 dataset. As a result it is possible, among other things, to determine whether the current dataset is the first or the last of the sub-page, how many datasets are displayed, etc.
The following methods can be applied to #cs.
Invocation | Description | Return data type |
---|---|---|
#cs.contentLength | Determines how many datasets 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 dataset in the sub-page. | |
#cs.dataset | Returns the current dataset of a multiple page. (For the first dataset of a multiple page see expression #global.dataset.) | |
#cs.dataset.javaClientUrl | Returns a URL to the current dataset on multiple pages. Clicking on the URL starts the FirstSpirit SiteArchitect, loads the project and opens the current dataset for editing. | String |
#cs.dataset.webeditUrl | Returns a URL to a page reference in which a specific dataset from the Content Store is output (multiple pages). When clicking on the URL, the FirstSpirit ContentCreator is started, the project is loaded, and the desired detailed page for editing the dataset is opened. | String |
#cs.isEvenContentRow | Determines whether the number of the current dataset in the sub-page is even. | Boolean |
#cs.isFirstContentRow | Determines whether the current dataset is the first in the sub-page of the multiple page. | Boolean |
#cs.isLastContentRow | Determines whether the current dataset is the last in the sub-page of the multiple page. | Boolean |
#cs.isOddContentRow | Determines whether the number of the current dataset 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 datasets
$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 dataset of how many datasets in total is output. In addition, for the first dataset 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