EE 2.9
PHP 5.5
Is there a way to distinguish between shared key names in a nested template loop? Example:
plugin function:
class Test_pi{
public function testloop(){
$inside_arr = array(
'inside' => 'Inside!',
'shared' => 'Shared Inside!'
);
$inside = array($inside_arr);
$outside_arr = array(
'outside' => 'Outside!',
'shared' => 'Shared Outside!',
'inarray' => $inside
);
$return_arr = array($outside_arr);
return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, $return_arr);
}
}template view:
{exp:test_pi:testloop}
{outside} {shared}
{inarray}
{inside} {shared}
{/inarray}
{/exp:test_pi:testloop}The desired output is
Outside! Shared Outside!
Inside! Shared Inside!but the actual result is
Outside! Shared Outside!
Inside! Shared Outside!so as you can see, the shared template variable name is not namespace respected, and I haven’t found a way to access the inside loop’s {shared} variable. I’ve tried stackoverflow and the EE docs on the template engine, but haven’t found anything. Anyone aware of a way to handle this, besides some third party product?