#global and multiple pages
Data source (content) based sections can be created in the Page Store. The special feature of pages which contain such sections is that the set of data records can be distributed.
In the Site Store the corresponding page reference has a tab Data. In this tab it is possible to specify how many data records are to be generated in a page and the maximum number of pages to be generated.
Pages generated by distribution of the data set are called Multiple pages (multipages).
This concept not only exists for data source based sections but in other places too.
To determine information from Multiple pages , there are two methods:
- .multiPageParams() (In general: Information of all generated pages)
- .pageParams() (In general: Information of one generated page)
Information of all pages (multiPageParams)
The method multiPageParams can be used to query and further process information on all generated pages of a multiple page (e.g. number of pages).
The basic structure of multiPageParams looks like this:
$CMS_VALUE(#global.multiPageParams[.METHOD])$
The following table lists the most important invocations of multiPageParams :
Invocation | Meaning | Return data type |
---|---|---|
#global.multiPageParams.pageCount | Returns the total number of pages. | |
Information of a page (pageParams)
The method pageParams can be used to invoke information on the currently generated page.
The general syntax of pageParams is:
$CMS_VALUE(#global.pageParams[.METHOD])$
The most important invocations of pageParams are given in the following table.
Invocation | Meaning | Return data type |
---|---|---|
#global.pageParams.index | Returns the current page number. The counting begins with 0. | |
#global.pageParams.isFirst | Determines whether the current page is the first of all pages. | Boolean |
#global.pageParams.isLast | Determines whether the current page is the last of all pages. | Boolean |
Data source based invocations
In addition to the general methods which can be invoked on a multiple page there are other methods for data source (content) based pages.
The following list names the most important of them:
Invocation | Meaning | Return data type |
---|---|---|
#global.node.content2Params.query. | Returns all parameters of the query. | |
#global.node.content2Params.getSelect(#global.language). | Returns the value of a query parameter. | String |
#global.node.content2Params.query. | Returns the default value of a query parameter. | String |
#global.node.content2Params.query. | Returns the used query of the multiple page. | String |
#global.node.content2Params.tableTemplate.id | Returns the ID of the table template used in the multiple page. | |
#global.node.content2Params.tableTemplate.templateId | Returns the template ID of the table template used in the multiple page. | |
#global.multiPageParams.data | Returns a list of all data records of the multiple page. | |
#global.multiPageParams.data.get(INTEGER) | Returns the given data record from the list. The parameter must be specified as an integer. If an integer is given which is greater than or equal to the number of data records this results in an error: | |
#global.multiPageParams.data.size | Number of all data records of the multiple page. | |
#global.multiPageParams.entitiesPerPage | Returns how many data records are to be displayed on a page (setting Number of entries per page). | |
#global.pageParams.data | Returns all data records of a page as a list. | |
#global.pageParams.data.get(INTEGER) | Returns the given data record from the list. The parameter must be specified as an integer. If an integer is given which is greater than or equal to the number of data records this results in an error: | |
#global.pageParams.data.size | Number of all data records of a page of the multiple page. | |
#global.pageParams.offset | Returns how many data records were output before the current page. | |
Examples
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: Offsetting data records on the basis of the page number (offset)
Offset:$CMS_VALUE(#global.pageParams.offset)$
The example calculates, on the current page, how many entries were displayed on the previous pages. The calculation only makes sense if the user selected the number of entries per page larger than 0. 0 would mean that all entries would be displayed on one page.
Exemplary output:
Offset:6