I have an image content type with fields for the various size images used in different parts of the website. I also have a shared template which I like to use across Rhythmyx in different slots. The markup of the template is the same apart from the image slot contents
I’m not sure I follow all of this, so if I’m answering the wrong question, please clarify for me.
It sounds like what you want to do is to pass the “image template” name to the #slot_wrapped macro so that all items in the image slot come out with that same template.
In this case, it’s a simple matter of specifying in the $params of the slot something like “template=MyImageTemplate” (where MyImageTemplate is the name or ID of a template).
Unfortunately, you cannot do this with #slot_wrapped (or #slot_simple) because they don’t pass enough parameters. Both of these macros just call #slot with some extra empty parameters, so in your case the code would be:
You cannot directly set the slot template value, but you can pass “bindings” from the parent template to the snippet.
If you, for example, create a “$imageSize” binding and set it in the parent template, the snippet templates (even ones that are nested within other snippets) will see this value. You can use this value in a #if statement in the image snippets, or you can use it in a dispatch template to select the correct template for the desired image size.
One word of caution: there are actually 2 different maps of variables. Values set on the bindings tab are passed downward to each successive template. When Velocity runs, it makes a COPY of the variable map, and so values that you create with #set in a Velocity page don’t change the values in the bindings map that is inherited by the snippet assembly.