Hello.
I’d like to create carousel with cbGetFieldContent, and I use wrapTpl option for it, but the snippet ignores this option and uses only the tpl chunk for every field. Could you help me to resolve this issue?
Here is my snippet call:
Hm, assuming field 19 is a repeater, I don’t see any reason that wouldn’t work. Is that your full snippet call or is there perhaps more you didn’t post for simplicity? Because you mention the &tpl property but that’s not there in what you posted. Sometimes an error elsewhere in the snippet call can prevent the parser from getting to other properties.
Have you triple checked the wrapTpl chunk name to make sure that is correct?
Also, there’s no need to call cbGetFieldContent uncached.
If all the information you need for the indicators can be parsed from the [[+rows]] output, you could use a custom snippet that parses that DOM as an output filter. Other than that, no, the current templating doesn’t doesn’t let you iterate over the rows twice with different templates.
Also I can’t use idx placeholder in the cbGetFieldContent snippet, when I call it inside the pdoResources, because it rewrite idx value. Is there another way to get counts of items?
Thank you.
This ^ is the most reliable approach to deal with parsing a repeater twice, you can get your idx through that custom snippet too. Depending on which idx you mean (there’s a number of different ones) they may be different when called in cbGetFieldContent vs the regular resource output.
Ah, I see, you’re iterating over individual image fields.
The &wrapTpl property only works for repeating fields, like the repeater, gallery, or files input types. It sets the wrapper which that one specific field, with multiple values, will use. The image input only has a single value, so no wrapper template, and no support for &wrapTpl.
In your case, I think you can simply put your wrapTpl in the template itself and call cbGetFieldContent twice: