Start page / Template development / Snippets / Thumbnail

Thumbnail field

Contents

The image input component that is to be used for the teaser image can be defined using this field.

In the case of search hits, this image is displayed on the right edge of the search hit, for example (see figures).

The following input components are available for referencing images, in addition to other uses:

If no input component is present in the template for selecting an image or if no image is to be displayed in the search result display, the field can be left empty.

Snippet definition

The snippet definition is generally created via the entry of a variable name for an input component defined in the template.

In order to be able to handle the returned object, methods that can be used with $CMS_VALUE(...)$ can be implemented. The usable methods are dependent on the returned object type. This means that the individual list entries are usually output using the map(String) method (for more information, see the List data type, for example).

Examples

st_picture

The image from the st_picture input component is used for the search result display.

if(!st_picture.isEmpty, st_picture, st_imagemap)

If the input component with the st_picture identifier is filled, the image from this input component is used for the search result; otherwise the image from the st_imagemap input component is used.

Alternatively, an image can be specified statically from the Media Store using

medium("REFERENCENAME")

or, for short,

"REFERENCENAME"

Where the placeholder REFERENCENAME has to be the reference name for the image to be displayed.

Images from remote projects

Images from remote projects can be output using

medium("REFERENCENAME", "REMOTEPROJECTNAME") 

where the placeholder REMOTEPROJECTNAME has to be the symbolic name of the requested remote project.

Images from datasets

Furthermore, images from datasets can also be used, such as those that have been embedded using FS_DATASET.

Important The use of objects of the Entity data type within snippets is not supported! The .getFormData() method should be used instead.

Example:

if(!pt_product.isEmpty, pt_product.dataset.formData.cs_picture)

Where pt_product is the identifier for the FS_DATASET input component used to select a dataset with an image, and cs_picture is the identifier of an input component in the table template where the image is saved.

For more information, see also the FormData data type.

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