Updating page level binging variables

Hello Team,

Can you guide me if it is possible to update the page level binding variables in a Snippet and accessing the updates in the page?

Scenario:

  1. I set the map binding variable in a page template and map has key1 and value1
  2. Accessed that binding variable in a snippet template and added few more key, value pairs (key2, value2 ; key3, value3 etc).
  3. When i am trying to access the map in page template after the snippet template updates it is not preserving the what ever the key value pairs we added in the snippet template. How can i do that?

I saw few posts in this forum about accessing the binding variables set on a page level in the snippets. But in my case i am looking for the next step.

Thanks
Thiresh Buddi

Hi,

You can try something like the following in Velocity. Note, this approach is not using anything on the Bindings tab of the templates, just setting them through code.

In snippet:


#set($bindings = $sys.assemblyItem.getCloneParentItem().getBindings())
$bindings.put("globalvartest_bind","value set from snippet")
$sys.assemblyItem.getCloneParentItem().setBindings($bindings)

In Page Template:


$sys.assemblyItem.getBindings().get("globalvartest_bind")

[QUOTE=buddithiresh;20851]Hello Team,

Can you guide me if it is possible to update the page level binding variables in a Snippet and accessing the updates in the page?

Scenario:

  1. I set the map binding variable in a page template and map has key1 and value1
  2. Accessed that binding variable in a snippet template and added few more key, value pairs (key2, value2 ; key3, value3 etc).
  3. When i am trying to access the map in page template after the snippet template updates it is not preserving the what ever the key value pairs we added in the snippet template. How can i do that?

I saw few posts in this forum about accessing the binding variables set on a page level in the snippets. But in my case i am looking for the next step.

Thanks
Thiresh Buddi[/QUOTE]