Blog Sections Open

Checking Whether a TV Field Is Empty with IF

When a TV looks filled in direct output but fails inside IF, the usual problem is how the condition is written, not the TV itself.

A common Evolution CMS task is to show a row, label, or block only when a TV actually contains data. the original question used the IF snippet but hit a logic issue even though the TV value printed correctly on its own.

The fragile version

[[if? &is=`[*words*]:!=:` &then=`...`]]

This style is easy to misread and easy to break once whitespace or parser order gets involved.

A cleaner pattern

Think in terms of “if this value is not empty, show the block”. Keep the TV output itself inside the displayed branch, not inside a complicated comparison string.

[[if?
  &is=`[*words*]:notempty`
  &then=`<span class="words">[*words*]</span>`
]]

For pagination blocks

The same rule applies: do not render pagination markup unless the underlying placeholder or snippet output is actually non-empty. That keeps single-page listings clean.

Recommendation

When IF conditions become hard to read, simplify them. In many templates it is better to test for emptiness directly than to build a long comparison expression around a TV tag.

Newer 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.

Older post

Building a jQuery Accordion Menu That Remembers Its State

A simple accordion menu becomes much easier to use when it remembers which branches were opened and highlights the current page.