Quick templating question. In the template markup below, I create a new array called "testArr", and attempt to populate it by calling array_merge. The first debug statement shows a properly initiatlized array with 0 elements in it. The second debug statement shows that "fields" is populated during each iteration of the loop. But for some reason, the debug statement at the end shows a NULL value for the final array. Any ideas? Thanks in advance!
Also, the docs mention that you can use "array()" with "vb: php". I had to remove the parentheses to get it to work at all. FYI!
Cheers.
Code:
{vb:set testArr, {vb:php array}} {vb:debugvardump testArr} <vb:each from="userInfo.customFields" key="category" value="fields"> {vb:debugvardump fields} <vb:each from="fields" key="name" value="field"> <vb:if condition="$category != 'default'" > {vb:set testArr, {vb:php array_merge, testArr, field}} </vb:if> </vb:if> </vb:each> {vb:debugvardump testArr}
Cheers.
Comment