I have a object with a method like this: $foo->getId() which returns an integer, and i have an array like:
$array(
1=> array(
"parent_id" => 14
),
2=> array(
"parent_id" => 15
)
);
I need to access parent_id inside the subarray in smarty using the $foo->getId() as index key for $array, something like:
{$array[$foo->getId()].parent_id}
also tried just:
{$array[$foo->getId()]}
But both return error:
syntax error: unidentified token
What am i not doing right?
{php}{/php}for that$foo->getId()which ver smarty?{$foo->getId()}in other parts without the{php}so that i know works, i'm not sure about the version, should be a recent one, let me check that.{{ array[foo.id].parent_id }}(or if you want an explicit method call:{{ array[foo.getId()].parent_id }})