Blog Sections Open

Building a Container Wrapper in MultiFields

A practical way to wrap MultiFields output in a slider, grid, or other reusable container in Evolution CMS.

MultiFields lets you define repeatable row structures, but sooner or later you need more than a row template. You also need a wrapper around the whole rendered block: a slider container, a grid, a tab panel, or any other outer shell.

The original question showed a row template that already rendered the individual item correctly. The missing step was to stop thinking only in terms of field-level templates and instead wrap the final output after MultiFields has rendered the rows.

Basic row output

[[multifields?
&tpl_rowSlider_text=`@CODE:<div class="akcia">[+value+]</div>`
&data=`[(client_akc)]`
]]

Configuration example

<?php

return [
    'settings' => [],
    'templates' => [
        'rowSlider' => [
            'type' => 'row',
            'value' => false,
            'items' => [
                'rowSlider_text' => [
                    'type' => 'richtext',
                    'placeholder' => 'Add promotion text',
                    'class' => 'col-12',
                ],
            ],
        ],
    ],
];

Wrapping the rendered rows

The cleanest approach is to let MultiFields render the rows and then place the snippet call inside your own outer markup.

<div class="promo-slider">
    [[multifields?
    &tpl_rowSlider_text=`@CODE:<div class="promo-slide">[+value+]</div>`
    &data=`[(client_akc)]`
    ]]
</div>

If you need an additional inner wrapper, add it directly to the row template or post-process the output inside a chunk. In practice this is easier to maintain than trying to force a global container into every field definition.

When to choose each option

  • use outer HTML around the snippet call when the wrapper belongs to the page layout
  • use a row template when the wrapper belongs to each repeated item
  • use a chunk when you want the same container pattern reused in several templates
Newer post

Handling File Uploads in FormLister

How to make FormLister file uploads work reliably, especially inside modal and AJAX-based forms.

Older post

Using bLang and DocLister in AJAX Requests

How to keep multilingual DocLister output in sync with the current bLang context during AJAX requests.