Blog Sections Open

Ordering Sidebar Chunks with a Custom TV in Evolution CMS

A flexible sidebar pattern that lets editors choose the order of chunk-based blocks with a custom TV and a small helper snippet.

Projects often need a sidebar where editors can turn blocks on or off and change the order without touching templates. This older solution used a custom TV plus a small parser snippet to keep that control inside the manager.

How the setup worked

  1. Install the custom sortable TV input.
  2. Create a TV such as ourCustomTv.
  3. Store the selected chunk names as a comma-separated list.
  4. Parse that list with a snippet and render the chunks in order.

Example parser snippet

<?php
$ar_chunks = explode(',', $chunks);
$ar_chunks = array_unique($ar_chunks);
$output = '';

foreach ($ar_chunks as $chunk) {
    if ($chunk != '') {
        $c = $modx->getChunk($chunk);
        if ($c) $output .= $c;
    }
}

if ($output != '' && isset($wrapperdiv)) {
    $output = '<div id="' . $wrapperdiv . '">' . $output . '</div>';
}

return $output;

Template call

[!chunkParser?chunks=`[*ourCustomTv*]` &wrapperdiv=`sidebarChunks`!]

This remains a good example of Evolution CMS at its best: a very small amount of code gives editors meaningful control over layout composition without introducing a heavy page builder.

Newer post

Tracking Resource Views with a TV and Plugin in Evolution CMS

A classic page-hit counter pattern for Evolution CMS using a text TV, an OnLoadWebDocument plugin, and optional listing integration.

Older post

Customizing the Evolution CMS Manager Tree and Top Menu

A manager plugin pattern for simplifying the admin interface and replacing parts of the tree or top navigation without patching core files.