Start page / Tutorials / First project / Working with section templates / Evaluation

Output in HTML

Now you will need to check the content of the entries in the input windows for the section text and image. This check is done using the $CMS_IF(...)$ instruction again:

Image reference

For the image reference, a check determines whether the st_picture input component contains content, i.e. a section image has been selected.

$CMS_IF(!st_picture.isEmpty)$
<img src="$CMS_REF(st_picture, resolution:"TextBildTeaser")$"
alt="$CMS_IF(!st_picture.media.description.isEmpty)$
$CMS_VALUE(st_picture.media.description.convert2)$
$CMS_END_IF$"
align="right"/>
$CMS_END_IF$
  

$CMS_IF(!st_picture.isEmpty)$

Specifies the name of the $CMS_IF(...)$ instruction used. A condition is specified in the instruction. (The reference name for the section image is "st_picture". The component is checked for Not Empty.)

$CMS_REF(st_picture,
resolution:"TextBildTeaser")$

$CMS_REF(...)$ resolves a reference to an image in the Media Store.
If a resolution other than the original is to be used, the resolution parameter must be specified. The parameter value is the TextBildTeaser resolution previously defined in the project properties.

alt="$CMS_IF(!st_picture.media.description.isEmpty)$
$CMS_VALUE(st_picture.media.description.convert2)$
$CMS_END_IF$"

The descriptive text for the particular image is output as alternative text, which must be defined in HTML using the alt attribute.

$CMS_END_IF$

Closes the $CMS_IF instruction

  

Section text

In the case of section text, the check determines whether the editor populated the st_text input component with content. If it contains content, the content is displayed, if the field is empty, nothing will be output.

	$CMS_IF(!st_text.isEmpty)$
$CMS_VALUE(st_text)$
$CMS_END_IF$
  

$CMS_IF(!st_text.isEmpty)$

Specifies the name of the $CMS_IF(...)$ instruction used. A condition is specified in the instruction. (The reference name for the section text is "st_text". The component is checked for Not Empty.)

$CMS_VALUE(st_text)$

The $CMS_VALUE(...)$ instruction is used for output of the "st_text" input component content. The name of the variable to be referenced is entered in the parentheses.

$CMS_END_IF$

Closes the $CMS_IF instruction

  

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