Start page / Templates (basics) / Composition of templates / Database schemata / Dataset output

Dataset output

Contents

FirstSpirit offers various options for generating datasets from data sources, for example on the website. Depending on the requirements and the project structure, some of these options may be more suitable than others. To create datasets in FirstSpirit, a table template is required.

via input components

Via the input components

editors can select datasets for output. FS_DATASET permits the selection of one dataset; FS_INDEX can be used to select multiple datasets. Depending on the configuration, the editor can use these input components not only to select datasets, but also to create new datasets.

FS_DATASET

There are two options for the output of datasets via FS_DATASET:

  1. The selection and output of the required dataset(s) use the same template (“central”; ...dataset.entity...).
  2. The selection and output of the required dataset(s) use separate templates (“decentral”). The output is generated using the table template used to create the datasets. Output to the template used to select the datasets takes place using a simple $CMS_VALUE(...)$ (...dataset.formData...).

1) In the first case, individual columns of the dataset are output based on the column names in the database schema:

$CMS_VALUE([identifier_of_FS_DATASET_input_component].dataset.entity.[column_name])$

Example (section template “st_contact”, output of contacts in right-hand margin column):

$CMS_VALUE(st_contact.dataset.entity.Salutation)$
$CMS_VALUE(st_contact.dataset.entity.Firstname)$
$CMS_VALUE(st_contact.dataset.entity.Lastname)$

2) In the second case, the contents of the datasets are output via the table template used to create the datasets:

$CMS_VALUE([identifier_of_input_component_table_template])$ </br>

Example:

$CMS_VALUE(cs_salutation)$ $CMS_VALUE(cs_lastname)$ </br>
Important If using table templates to generate output, ensure that only dynamic content (e.g., using $CMS_VALUE(...)$; no static text!) is output, as all content will be output on the output register of a table template for each dataset based on this template, and therefore potentially may appear multiple times on a single page.

In the template used to select the datasets, the content of the input components is output using $CMS_VALUE(...)$ and the identifiers of the input components:

$CMS_VALUE(identifier_of_FS_DATASET_input_component].dataset.formData])$

Example:

$CMS_VALUE(st_dataset.dataset.formData)$

For more information, see also data type DatasetContainer.

FS_INDEX

There are two options for the output of datasets via FS_INDEX (with DatasetDataAccessPlugin):

  1. The selection and output of the required dataset(s) use the same template (“central”). The input component identifiers of the table template used to create the datasets must be known in order to generate an output. This allows the output of the data in the dataset to take place independently of the table template on which it is based. The syntax requires the use of $CMS_FOR(...)$.
  2. The selection and output of the required dataset(s) use separate templates (“decentral”). The output is generated using the table template used to create the datasets. Output to the template used to select the datasets takes place using a simple $CMS_VALUE(...)$.

1) In the first case, the contents of the selected datasets are output using the instruction $CMS_FOR(...)$ and the input component identifiers from the table template:

$CMS_FOR([variable], [identifier_of_input_component])$
($CMS_VALUE([variable].fs_id)$) $CMS_VALUE([variable].[identifier_of_input_component_table_template])$</br>
$CMS_END_FOR$

Example:

$CMS_FOR(_entry, st_list)$
($CMS_VALUE(_entry.fs_id)$) $CMS_VALUE(_entry.cs_salutation)$ $CMS_VALUE(_entry.cs_lastname)$ </br>
$CMS_END_FOR$

For more information, see also the pages on data types Index and Record.

2) In the second case, the contents of the datasets are output via the table template used to create the datasets:

$CMS_VALUE([identifier_of_input_component_table_template])$ </br>

Example:

$CMS_VALUE(cs_salutation)$ $CMS_VALUE(cs_lastname)$ </br>
Important If using table templates to generate output, ensure that only dynamic content (e.g., using $CMS_VALUE(...)$; no static text!) is output, as all content will be output on the output register of a table template for each dataset based on this template, and therefore potentially may appear multiple times on a single page.

In the template used to select the datasets, the content of the input components is output using $CMS_VALUE(...)$ and the identifiers of the input components:

$CMS_FOR([variable], [identifier_of_input_component_table_template.values])$
($CMS_VALUE([variable].formData)$</br>
$CMS_END_FOR$

Example:

$CMS_FOR(_entry, st_list)$
($CMS_VALUE(_entry.fs_id)$) $CMS_VALUE(_entry.cs_salutation)$ $CMS_VALUE(_entry.cs_lastname)$ </br>
$CMS_END_FOR$

via content projection

To output datasets via “content projection” (see also Output the structured datasets and Using queries to influence the output results), the required data source is attached to the required page in the Page Store. This step is not usually performed by the editor, but by the template/project developer. This projection generally contains all datasets for the selected data source. In the Site Store (page reference, tab “Data”) the following settings can be configured:

  • How many datasets from the data source should be output per page? (field “Number of entries per page”)
  • Should the datasets be output on multiple pages, and if so, how many pages? (field “Maximum number of pages”)
  • A query can be used to filter the dataset for output. (field “Filtering Configuration”)
  • The datasets can be output sorted by data source column. (field “Sort Order”)

When using content projection, the editor can, in principle, only influence the output by creating new datasets or editing or deleting existing datasets. Generally, the editor is unable to specify which and how many datasets from the data source should be output on which page(s).

The datasets can be output in any table template connected to the required table in the database schema (table template, tab “Mapping”, field Connected to table). The contents of the individual columns can be output using

  1. the identifiers of the relevant input components
    (only if the datasets are also maintained using this table template, i.e., if forms are defined)
  2. the system object #row

Note: If the datasets are selected via FS_INDEX, the order selected for output via the system object #row is not taken into account.

Example for 1)

$CMS_VALUE([identifier_input_component_table_template])$

Example (output via a table template, output of one dataset per page):

$CMS_VALUE(cs_date.format("dd.MM.yyyy"))$</br>
$CMS_VALUE(cs_headline)$

Example for 2)

$CMS_VALUE(#row.[column_name])$

Example (output via a table template, output of multiple datasets on one page):

$CMS_VALUE(#row.Date.format("dd.MM.yyyy"))$</br>
$CMS_VALUE(#row.Headline.convert2)$

Navigation
If the configuration of the “Data” tab results in more than one page being generated, all generated pages are automatically linked as a page group, so that they can be referenced using the page group function. This function enables the user to create a navigation path through the generated pages.

Important Permissions which are assigned for data sources (see also Editorial permissions (→Documentation FirstSpirit SiteArchitect)) are not considered for filters in ContentCreator for technical reasons (context menu option “Set filter”, see also Context menu - “Extras” (→Documentation FirstSpirit SiteArchitect)).

using the "contentSelect" function

The contentSelect function can be used in page and section templates to enable the output of datasets from a table in a database schema. The datasets can be output filtered and/or sorted, but only on a single page. For filtering and sorting purposes, tags and parameters can be used; these are explained in further detail on the Database queries page.

When using the contentSelect function, the editor can, in principle, only influence the output by creating new datasets or editing or deleting existing datasets. Generally, the editor is unable to specify which and how many datasets from the data source should be output on which page(s).

Minimal configuration of the function:

<CMS_FUNCTION name="contentSelect" resultname="[variable]">
<CMS_PARAM name="schema" value="[name_of_database_schema]" />
<QUERY entityType="[name_of_table_in_database_schema]"/>
</CMS_FUNCTION>

Example (section template, output of press release teasers in the margin columns):

<CMS_FUNCTION name="contentSelect" resultname="cs_press_releases">
<CMS_PARAM name="schema" value="Products" />
<QUERY entityType="Press_Releases"/>
</CMS_FUNCTION>

This function is used to select which datasets should be output (filtering) and to sort the data.

The contents of the required columns are output outside the <CMS_HEADER> area using $CMS_FOR(...)$:

$CMS_FOR([variable], [resultname_of_function])$
$CMS_VALUE([variable].[column_name])$<br/>
$CMS_END_FOR$

Example:

$CMS_FOR(_entity, cs_press_releases)$
$CMS_VALUE(_entity.Headline)$<br/>
$CMS_END_FOR$

Summary

 

Use

Output using $CMS_VALUE(...)$

FS_DATASET

in all templates with a form tab

...[identifier_FS_DATASET_input_component].dataset.entity.[column_name]...

or

...[identifier_FS_DATASET_input_component].dataset.formData...
(if output generated via a table template)

FS_INDEX

in all templates with a form tab

$CMS_FOR([variable], [identifier_FS_INDEX_input_component.values])$
($CMS_VALUE([variable].formData)$</br>
$CMS_END_FOR$


or

...[identifier_FS_INDEX_input_component]...
(if output generated via a table template)

Content projection

in table templates

...[identifier_input_component_table_template]...

or

...#row.[column_name]...

contentSelect

in all templates with an output tab

<CMS_HEADER> area:
<CMS_FUNCTION name="contentSelect" resultname="[variable]">
<CMS_PARAM name="schema" value="[name_database_schema]" />
<QUERY entityType="[name_table]"/>
</CMS_FUNCTION>


outside the <CMS_HEADER> area:
$CMS_FOR([variable], [resultname])
$CMS_VALUE([variable].[column_name])
$CMS_END_FOR$

   

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