Blog Sections Open

count_down: A Small Countdown Snippet Pattern for Evolution CMS

A short ecosystem-style note on building a reusable countdown output for Evolution CMS pages from resource date data.

Small presentation snippets often solve very practical editorial needs, and countdown logic is a good example. The donor post adapted a Revo-style idea into a simple Evolution CMS snippet that reads a target date, calculates the remaining interval, and prints a frontend-ready counter wrapper.

Core idea

$resource = $modx->getObject('modResource', 37);
$date_end = $resource->get('unpub_date');

$datetime1 = new DateTime('now');
$datetime2 = new DateTime($date_end);
$interval = $datetime1->diff($datetime2);
$time_left = $interval->format('%d %H:%i:%s');

The snippet then wraps the result in markup that a frontend timer script can animate.

This kind of helper is useful because it shows how little code is needed to bridge resource data and presentational JavaScript when the requirement is narrow and clear.

Source: Extras.Evolution snippet catalog.

Newer post

evo-template-on-bulma: A Starter HTML Direction for Evolution CMS 2.0 Lessons

An ecosystem post about evo-template-on-bulma as a starter HTML base used for later Evolution CMS 2.0 lessons.

Older post

EvoFilter: A More Flexible Filtering Direction for Evolution CMS

An ecosystem note on EvoFilter and how it aimed to simplify TV-driven filtering workflows in Evolution CMS.