CvP
11-30-2011, 06:17 PM
Sample code:
<vb:if condition="$first_item = X($myvar)">
<!-- do something -->
</vb:if>
<vb:each from="myvar" key="k" value="v">
<!-- do something -->
</vb:each>
I tried array_shift(), each() methods in place of X. Doing so causes this error.
Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3555
Anyone have any idea how to workaround this?
PS: I'm aware of the counter workaround in vb:each but that doesn't go well with how I wanna write the template.
The only workaround I can now think of array_shift the value in the actual php code (rather than in template) before registering the variable to the template which is something I wanna avoid.
btw, you'll need to add this plug in to use these functions:
hook: template_safe_functions
code: $safe_functions[] = 'each';
<vb:if condition="$first_item = X($myvar)">
<!-- do something -->
</vb:if>
<vb:each from="myvar" key="k" value="v">
<!-- do something -->
</vb:each>
I tried array_shift(), each() methods in place of X. Doing so causes this error.
Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3555
Anyone have any idea how to workaround this?
PS: I'm aware of the counter workaround in vb:each but that doesn't go well with how I wanna write the template.
The only workaround I can now think of array_shift the value in the actual php code (rather than in template) before registering the variable to the template which is something I wanna avoid.
btw, you'll need to add this plug in to use these functions:
hook: template_safe_functions
code: $safe_functions[] = 'each';