I have written my first funcitoning snippit. I’m so happy. It is very simple: The snippit takes one or two parameters and parses a chunk with placeholders for those paprameters. The Chunk is a MaxiGallery snippit call. In this way I can take a legnthy snippit call that I use all over the place and reduce it down to a very short call. The code looks like this:
$params['mgPicID']=$mgPicID;
$chunk=$modx->parseChunk('mg1PicCall', $params, '[+', '+]');
return $chunk;
My next hurdle is that the snippit in the chunk accepts templates, stored in chunks and called by chunk name. I would like to insert placeholders in the template chunks and use my snippit to fill those in, but I can’t figure out how. I’ve looked at the setPlaceholder API function, but I didn’t get anywhere with that. Can someone point me in the right direction.