Blog Sections Open

Outputting a TV Label and Value Only When the TV Is Filled

If a TV may be empty, wrap the whole row or list item in a condition so that the label and the value disappear together.

Many Evolution CMS templates need to display optional metadata such as “Airport type: civil” or “Material: steel” only when the TV has a value. The safe pattern is to conditionally render the whole row, not just the value.

Table example

[[if?
  &is=`[*tip_airport*]:notempty`
  &then=`<tr><td>Airport type</td><td>[*tip_airport*]</td></tr>`
]]

List example

[[if?
  &is=`[*tip_airport*]:notempty`
  &then=`<li>Airport type: [*tip_airport*]</li>`
]]

Why this pattern is better

It prevents empty labels, broken table rows, and awkward spacing in lists. It also keeps the template readable because the condition and output stay together.

Recommendation

Whenever the TV is optional, wrap the entire semantic block. That makes your markup cleaner and your templates easier to maintain.

Newer post

Counting How Many TV Fields Actually Contain Data

If a resource has several image TVs, count only the filled ones before you decide how to build the gallery or slider output.

Older post

Running Different Snippets for Different Web User Groups

If wholesale and retail users need different storefront behavior, the cleanest solution is to branch rendering by web group instead of cloning the entire page.