![]() |
mainupating a variable in template before using in vb each
Sample code:
HTML Code:
<vb:if condition="$first_item = X($myvar)"> Code:
Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3555 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'; |
I tried it using array_shift and it seems to work.
Code:
$myvar = array('First', 'Second', 'Third'); Code:
<vb:if condition="$first_item = array_shift($myvar)"> I couldn't see how you could get to fetch_error_array() with $errors not an array unless maybe you have a plugin that changes $errors (maybe using hook template_compile?) or maybe a custom tag. |
I think it has to do with my array being multi-level :/
|
All times are GMT. The time now is 04:12 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|