Inserts a single value into the passed array at the passed index.
<mvt:assign name="l.index" value="miva_array_insert( array, value, i )" />
Note: if the passed array is undefined, miva_array_insert
will create the variable.
array - An array structure.
value - Any value, either variable or literal.
i - The index to insert the value at. If -1 is used, the value will be inserted at the END of the array.
int - The index of the inserted value.
<!-- "Push" the 'Hello' string at the end of the array -->
<mvt:assign name="l.index" value="miva_array_insert( l.settings:array, 'Hello', -1 )" />
- php
- array_push
- array_unshift
Convert a Miva array structure into a string.
<mvt:assign name="g.output" value="miva_array_serialize( array )" />
miva_array_serialize
maps key -> value pairs in a comma separated string.
array - An array structure.
string - A string representation of the passed array.
<!-- Dump a mapped, string based representation of the "product" variable into "output" -->
<mvt:assign name="g.output" value="miva_array_serialize( l.settings:product )" />
<!-- Render output's value onto the page: -->
<!-- &mvt:global:ouput; -->
- php
- print_r
- var_dump
- var_export
- serialize