|
Iterate through an array starting at a given offset, execute a filter expression against each element, and create a new member with references to the members in the output array. See also miva_array_filter.
In this example the array l.facets is filtered into a new array l.enabled_facets by reference. Reference means that l.enabled_facets does not contain a copy of the filtered records, but a pointer to the original record, this is faster and uses less memory than miva_array_filter( ) miva_array_filter_ref( l.facets, 1, l.facet, 'NOT ISNULL l.facet:display', l.enabled_facets )' The example code below is a representation (not the actual code) of what is going on within the function to clarify the parameters.
<MvFOREACH ITERATOR = "l.facet" ARRAY = "l.facets"> <MvIF EXPR="{ NOT ISNULL l.facet:display }"> <MvASSIGN NAME="l.return_count" VALUE="{ miva_array_insert_ref( l.enabled_facets, l.facet, -1 ) }"> </MvIF> </MvFOREACH> |