Awesome -- I got the getChunkIf snippet to work -- but only when called cached (why doesn't it work when called uncached?) and only if I substitute this:
if (!empty($scriptProperties['placeholder'])){
$subject = $modx->getPlaceholder($scriptProperties['placeholder']);
}
for this:
if (!empty($scriptProperties['placeholder'])){
$subject = '[[+'.$modx->getPlaceholder($scriptProperties['placeholder']).']]';
}
$modx->parser->processElementTags('',$subject,true,true);
I'm pretty sure the latter is just a typo, as you can also substutute:
if (!empty($scriptProperties['placeholder'])){
$subject = '[[+'.$scriptProperties['placeholder'].']]';
}
$modx->parser->processElementTags('',$subject,true,true);
And it also works.
Anyway, I'm stoked, I bet this is quite a bit more efficient than the other method I was using.