Blog Sections Open

Rendering a TV Row Only When the TV Has a Value

A neat manager-side pattern for putting conditional presentation directly into the TV configuration so templates stay cleaner and output only appears when the field is filled.

Conditional TV output is often handled with PHx, IF snippets, or helper plugins. the note reminded everyone that some cases can be solved more cleanly by letting the TV itself define its own output wrapper.

The usual approaches

  • PHx-based conditions around a table row
  • an IF snippet that prints markup only when the placeholder is not empty
  • a cleanup plugin that removes empty blocks afterward

The simpler idea

Let the TV output setting contain the wrapper markup and use the placeholder itself as the value source. Then the template only needs something as small as:

[+name+]

while the TV configuration controls how the final row is rendered when the field is present.

Why this is elegant

  • templates become smaller
  • presentation rules stay close to the field definition
  • repeated conditional blocks do not have to be duplicated everywhere
Newer post

Why DocLister Became the Natural Successor to Ditto and CatalogView

A historical extras article about the moment DocLister emerged as a cleaner and more scalable listing approach for Evolution CMS.

Older post

Using jquery-timeago with Evolution CMS Dates

A lightweight frontend enhancement for showing relative publication times such as “5 minutes ago” using Evolution CMS date output and the jquery-timeago plugin.