Start page
Start page
Start page

Start page / Advanced topics / Media galleries / Section template

Section template

Example of object chooser input component

If the media gallery function is to be made available in the Page Store, a corresponding section template must be created. This is done using the CMS_INPUT_OBJECTCHOOSER input component, via which the datasets from the gallery table can be accessed.

The unique identifier of the gallery table template must be given as the value for the table parameter.

The input component can be configured so that existing entries can be selected from the gallery table or new datasets can be created in the gallery table.

Example of "section-dependent gallery settings" tab

A section template with two tabs is realised in order to give the editor the choice of whether the data (i.e. name, description, teaser image(s)) of a selected gallery are to be adopted from the gallery table or whether their own data is to be entered for this section. If the editor enters data in the "Section-dependent gallery settings" tab, it is output on the website. If the tab remains empty, the "Gallery" tab data is output.

Important The following examples clearly show the difference between the "section-dependent data" and the data from the gallery table by appending _SECTION for section-dependent data and _TABLE for the data selected from the gallery table using the CMS_INPUT_OBJECTCHOOSER input component.

HTML tab example:

$CMS_IF(isSet(GALLERYNAME_SECTION) && !GALLERYNAME_SECTION.isEmpty)$
$CMS_SET(_galleryName, GALLERYNAME_SECTION)$
$CMS_ELSE$
$CMS_SET(_galleryName, GALLERYNAME_SECTION.name)$
$CMS_END_IF$

In this example, a check is performed to see whether the "Gallery name" field in the section (GALLERYNAME_SECTION variable) is completed. If the field is completed in the "Section-dependent settings", the entered value is used, if the field is empty, the name from the gallery table is used.

The same procedure can be used for the gallery description and teaser.

Section Template form example

<CMS_MODULE>
<CMS_GROUP tabs="top">

<CMS_GROUP>
<LANGINFOS>
<LANGINFO lang="DE" label="Absatzgebundene Galerie-Einstellungen"/>
<LANGINFO lang="*" label="Section based gallery settings"/>
</LANGINFOS>

<CMS_INPUT_TEXT name="GALLERYNAME_SECTION" singleLine="no" useLanguages="yes">
<LANGINFOS>
<LANGINFO lang="DE" label="Galerie-Name" description="Überschrift der Galerie"/>
<LANGINFO lang="*" label="Gallery Name" description="Set a name for the selected gallery"/>
</LANGINFOS>
</CMS_INPUT_TEXT>

<CMS_INPUT_TEXTAREA name="GALLERYDESCRIPTION_SECTION" allowEmpty="yes" useLanguages="yes">
<LANGINFOS>
<LANGINFO lang="DE" label="Galeriebeschreibung" description="Galeriebeschreibung"/>
<LANGINFO lang="*" label="Gallery Description" description="Gallery Description"/>
</LANGINFOS>
</CMS_INPUT_TEXTAREA>

<CMS_INPUT_PICTURE
name="TEASER_SECTION"
allowEmpty="yes"
imagePreview="yes"
lean="mandatory"
upload="yes"
useLanguages="no">
<LANGINFOS>
<LANGINFO lang="DE" label="Teaserbild" description="Teaserbild"/>
<LANGINFO lang="*" label="Teaser" description="Teaser"/>
</LANGINFOS>
</CMS_INPUT_PICTURE>
</CMS_GROUP>

<CMS_GROUP>
<CMS_INPUT_OBJECTCHOOSER
name="GALLERYDATA_TABLE"
allowChoose="yes"
allowEdit="yes"
delete="yes"
hFill="yes"
table="GALLERYTABLE"
useLanguages="no">
<LANGINFOS>
<LANGINFO lang="DE" label="Galerie" description="Galerie wählen/hinzufügen/entfernen"/>
<LANGINFO lang="*" label="Gallery" description="Gallery select/add/remove"/>
</LANGINFOS>
</CMS_INPUT_OBJECTCHOOSER>

</CMS_GROUP>
</CMS_MODULE>

© 2005 - 2012 e-Spirit AG | All rights reserved. | Last change: 05.09.2011