Skip to content

{exp:stash:copy}

Mark Croxton edited this page Jun 21, 2013 · 6 revisions

Makes a copy of an existing variable. By default the cloned variable will be created with the same scope, context and type of the original, but that can be changed. Currently, only variables assigned to the default bundle can be copied.

{exp:stash:set name="foo"}bar{/exp:stash:set}

{!-- make an identical copy --}
{exp:stash:copy name="foo" copy_name="foo_copy"}

{!-- copy the value but set an new context, type and scope for the copied variable --}
{exp:stash:copy 
    name="foo" 
    copy_name="foo_copy2" 
    copy_scope="site" 
    copy_context="foo" 
    copy_type="snippet"
}

{!-- prints "bar" --}
{exp:stash:get name="foo_copy"}

{!-- prints "bar" --}
{exp:stash:get name="foo_copy2" scope="site" context="foo" type="snippet"}

Parameters

name = "[ string ]"

The name of the original.

scope = "[ local | user | site ]"

The scope of the original.

context = "[ string ]"

The context of the original.

type = "[ variable | snippet ]"

The type of the original.

copy_name = "[ string ]"

The name of the copy.

copy_scope = "[ local | user | site ]"

The scope of the copy.

copy_context = "[ string ]"

The context of the copy.

copy_type = "[ variable | snippet ]"

The type of the copy.

Clone this wiki locally