Blog Sections Open

Wrapping Every Three Ditto Items for a Carousel Layout

Carousel markup usually needs grouped output, so treat every third Ditto item as a boundary for opening and closing the wrapper block.

This donor is the three-item version of the same grouping problem teams often hit with Ditto. Instead of a flat item list, the output needs to be grouped into slides or rows, each containing up to three entries.

Typical strategy

Use ditto_iteration or an equivalent iteration placeholder to detect each third item and wrap the group accordingly.

[[if? &is=`[+ditto_iteration+]:%:3` &math=`on` &then=`...`]]

Edge case

The last wrapper still needs to close correctly even when the final group contains only one or two items. That is why grouped Ditto layouts often become easier to manage through a helper snippet once the markup gets more complex.

Newer post

Working with Checkbox Inputs in eForm

Checkboxes in eForm need explicit handling because an unchecked box sends nothing, while a checked one sends a value that still must pass validation.

Older post

Using a TV Value as the documents Source for Ditto

When a TV stores a comma-separated list of resource IDs, Ditto can use it as the source list — but you need to read the TV from the correct document first.