I have a template that I need to have nested values in. The documentation seems to cover this well but only from the template side.
Here's a simplified version of the template:
Code: Select all
<!-- BEGIN outer_loop -->
<< do some markup>>
<!-- BEGIN inner_loop -->
<< do some markup>>
<!-- END inner_loop -->
<< do some markup>>
<!-- END outer_loop -->
The question is, I'm unclear how the PHP side of this should look and I can't figure it out (have tried numerous things). What is throwing me is how to assign the template variables for the nested inner loop. Should I be assigning the vars to an array within the first array and then only assigning block variables just to the outside? I also thought you might be able to qualify/name the inner using a "outer_loop.inner_loop" convention, but that didn't do it either.
For example:
Code: Select all
<<start outer PHP looping construct>>
$array1['a'] = 'foo';
$array1['b'] = 'bar'l
$template->assign_block_vars('outer_loop', $array1);
<< start inner PHP looping construct >>
$array2 = array();
$array2['c'] = 'oof';
$array2['d'] = 'rab';
// Should this be:
$template->assign_block_vars('inner_loop', $array2);
// or
$template->assign_block_vars('outer_loop.inner_loop', $array2);
// or
$array1['innerloop'] = $array2;
// or ????
<< end inner PHP looping construct >>
<< end outer PHP loop>>