How do I reinitialize a slot with new parameters?

I have two auto slots that load a series of slides for a slider. I use a generic Auto Slot called ‘SlotAuto’ and call it with different sets of parameters. This worked when i set the parameters in the bindings, but I had to move the $modday out of the bindings because it threw an error when I tried to set it in the bindings.

The first auto slot has the parameters defined in the bindings. But then I need to set a second set of parameters in the code and call the second slot. But I think I am missing the code I need to reinitialize the slot with new parameters and can’t seem to find an code example of how to do this. When I run the code, the second slot just outputs the first slot parameters again.

#slot(‘SlotAuto’ ‘’ ‘<li>’ ‘</li>’ ‘’ $slide1params)

##code to reverse the sort order on alternating days
#set($day = $tools.date.getDay())
#set($modday = $tools.math.mod($day,2))
#if ($modday == 0)
#set($sortorder = “rx:sort_order asc”)
#else
#set($sortorder = “rx:sort_order desc”)
#end

#set($slide2params.query = “SELECT rx:sys_contentid, rx:title_link, rx:display_title, rx:caption_text FROM rx:ImageSlider where jcr:path like ‘//Sites/Internet/slider/%’” )
#set($slide2params.template = “SnImageSlider”)
#set($slide2params.max_results = $maxplaceholders) ##set in the bindings
#set($slide2params.order_by = $sortorder)

#slot(‘SlotAuto’ ‘’ ‘<li>’ ‘</li>’ ‘’ $slide2params)

Why would the second slot display the same query as the first slot even though I have given it a new set of parameters? Do I need to call the slot a different way or does it need to be initialized in some way?

I’m not sure what the problem is, but I can tell you what I’d look at:

  1. Since both slot calls are using the same slot ‘SlotAuto,’ I’d confirm that its slot finder does not have a hard-coded query string defined in its ‘query’ parameter.

  2. I’d try zeroing out all param values immediately after each slot call, and explicitly setting slot param values immediately prior to each slot call, to be sure there are no unintended values passed. On a previous project, we used the same name ($slotparams) on any template using a slot. We’d set only one $slotparams parameter value on the template’s Bindings tab to init the map (often “$slotparams.template”), and set all other param values in the template source - following our coding standard to zero out values in the lines imm. after each/any slot call.

  3. Finally, we used the following technique we found on these forums where the $more variable was never used but was necessary part of setting a new binding value passed in to a template.

##    Set parameter 'more' so that ##
##    the next template will know to render the "See More" link ##
#set($more = $sys.assemblyItem.bindings.put('$more', "1"))
#slot("slotFeatureItems" "&lt;div class='inset-feature-items'&gt;" "" "" "&lt;/div&gt;&lt;div class='clearfix'&gt;&lt;/div&gt;" $slotparams)
## Set $more back to 0 (zero) to prevent legacy values from trickling through when they shouldn't ##
#set($more = $sys.assemblyItem.bindings.put('$more', "0"))

HTH