Blog Sections Open

Using the IF Snippet Safely When Zero Is a Valid Value

A practical IF snippet note for eForm thank-you pages and other templates where zero is meaningful data, not a missing value.

Zero is one of the easiest values to mishandle in template logic. In Evolution CMS this often shows up in the if snippet, where a value like 0 is meaningful, but the surrounding logic treats it as if nothing was entered.

Example

[!if?
&is=`[+pay+]:is:0`
&then=`<p>Your request will be reviewed before payment is required.</p>`
&else=`<p>A paid response is available.</p>`!]

This is a perfectly valid pattern, but only if the form and thank-you flow preserve the pay value correctly.

What usually goes wrong

  • The field never reaches the thank-you template.
  • The value is empty, not zero.
  • The comparison is written too loosely and mixes empty-state logic with numeric-state logic.

Best practice

When zero is meaningful, compare explicitly against zero and keep that branch separate from “empty” or “missing” states. This is especially important in eForm thank-you pages where pricing, moderation, or next-step logic depends on one numeric field.

Readable conditional logic matters here. A zero-value branch should be obvious to the next developer instead of hidden inside a loose truthy check.

Newer post

Getting a Full List of Users Programmatically in Evolution CMS

How to fetch all users programmatically in an Evolution CMS project when you need to process user data in PHP instead of through the manager UI.

Older post

Breaking a Ditto News Feed to Insert a Banner or Promo Block

How to split a Ditto news stream at a chosen position so a banner or promotional block can be inserted without rewriting the whole listing.