ezpagedata_append( key, value )
Name | Type | Description | Required |
---|---|---|---|
key | string | The key from the persistent variable to append into. | Yes. |
value | mixed | The value to add into your persistent variable. | Yes. |
The ezpagedata_append() operator appends a new value into a persistent variable into your page data. The new value will be added as a array entry.
If the target persistent variable is not a array, then an array will be created, replacing the existing value. Please note that this will destroy the previously stored data in your persistent variable.
If the target persistent variable doesn't exist, a new one will be created.
This operator has been introduced by eZ Website Interface, and it is required that the ezwebin extension is installed to use it.
Created/appended persistent variables can be accessed by using the ezpagedata() operator.
{ezpagedata_set('my_new_persistent_variable', hash('my_value',918))} {ezpagedata_append('my_new_persistent_variable', hash('my_second_value',64))} {def $mypageData = ezpagedata()} {$mypageData.persistent_variable|attribute(show)}
A new value should be appended into your 'my_new_persistent_variable' persistent variable.
When using the attribute(show) operator to output the content of your persistent_variable it should look like the following:
Attribute | Type | Value |
---|---|---|
js_files |
array |
Array(6) |
>0 |
string |
'ezjsc::yui3' |
>1 |
string |
'ezjsc::yui3io' |
>2 |
string |
'ezcontentstaging_yui3.js' |
>3 |
string |
'node_tabs.js' |
>4 |
string |
'ezjsc::yui2' |
>5 |
string |
'ezajaxsubitems_datatable.js' |
my_new_persistent_variable |
array |
Array(2) |
>my_value |
integer |
918 |
>my_second_value |
integer |
64 |
{ezpagedata_set('my_second_persistent_variable','Some text')} {ezpagedata_append('my_second_persistent_variable','Another text')} {def $mypageData = ezpagedata()} {$mypageData.persistent_variable|attribute(show)}
The 'my_second_persistent_variable' persistent variable should be replaced with an array.
The output created by the attribute(show) operator should look like the following:
Attribute | Type | Value |
---|---|---|
js_files |
array |
Array(6) |
>0 |
string |
'ezjsc::yui3' |
>1 |
string |
'ezjsc::yui3io' |
>2 |
string |
'ezcontentstaging_yui3.js' |
>3 |
string |
'node_tabs.js' |
>4 |
string |
'ezjsc::yui2' |
>5 |
string |
'ezajaxsubitems_datatable.js' |
my_second_persistent_variable |
array |
Array(1) |
>0 |
string |
'Another text' |
{ezpagedata_append('my_third_persistent_variable',hash('value1','Hello world!'))} {def $mypageData = ezpagedata()} {$mypageData.persistent_variable|attribute(show)}
The 'my_third_persistent_variable' persistent variable will be created, since it doesn't exists.
The output created by the attribute(show) operator should look like the following:
Attribute | Type | Value |
---|---|---|
js_files |
array |
Array(6) |
>0 |
string |
'ezjsc::yui3' |
>1 |
string |
'ezjsc::yui3io' |
>2 |
string |
'ezcontentstaging_yui3.js' |
>3 |
string |
'node_tabs.js' |
>4 |
string |
'ezjsc::yui2' |
>5 |
string |
'ezajaxsubitems_datatable.js' |
my_third_persistent_variable |
array |
Array(1) |
>value1 |
string |
'Hello world!' |