Template Bindings

Hello,

In the following template code, I am using bindings to pass values from page template to snippet template.

#set($slotname = “homepage_main_slot_one”)
#initslot($slotname $slotparams)##
#set($size = $sys.currentslot.relresults.size())
#if($sys.currentslot.relresults.size() > 0)
#foreach($relresult in $sys.currentslot.relresults )
#set($xyz = $sys.assemblyItem.bindings.put(‘$foo’, “bar”))
$rx.doc.extractBody($relresult)
#end
#end
#endslot($slotname)

and in my snippet template I am using the binding value as

<p>Binding for foo is: $foo</p></br/>

I am able to initialize and pass a binding if it is declared outsiode #initslot. How can I achieve the same functionality within #initslot()?

I have the exact same question. I need to set bindings AFTER the #initslot call and within the loop (yes, it works only before the #initslot call but not after). The plan is to set a different binding value in each iteration of the loop so that the snippet template can take advantage of the new values every time.

Any ideas ?