<h1>A Category</h1> <div>An Item 01</div> <div>An Item 02</div> <h1>Another Category</h1> <div>An Item 03</div> <div>An Item 04</div> <div>An Item 05</div> <div>An Item 06</div> ...
This question has been answered by Bruno17. See the first response.
[[+category:isnot=`[[+oldcategory]]`:then=` <h1>[[+category]]</h1> `:else=``]] [[!setPlaceholder? &placeholder=`oldcategory` &value=`[[+category]]`]] <div>An Item [[+idx]]</div>
$modx->setPlaceholder($placeholder,$value);
[[setPlaceholder? &placeholder=`oldcategory` &value=`[[+category]]`]]