hi,
is there a way to detect whether a tag variable parsed by the template parser is a single variable entry or an array?
ex:
$myarray = array(array('mytag' => 'sample'));
$this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $myarray);using this i can access mytag variable in the publish page like
{mytag}then
$myarray = array(array('mytag' => array(array('mytag1' => 1), array('mytag1' =>1))));using this i can access the variables like
{mytag}
{mytag1}
{/mytag}now the problem is i dont have much control over the value of $myarray. so sometimes it will return just a single variable and sometimes it will contain more and sometimes it wont exist. btw im passing a large multi dimensional array.
is there a way to detect this so that i can properly adjust the code on the template?
Can you not detect it and assign another variable to the template? i.e.:
$myarray = array(array('mytag' => array(array('mytag1' => 1), array('mytag1' =>1))));
if (is_array($myarray['mytag'])) {
$myarray = $myarray + array('is_array', true);
} else {
$myarray = $myarray + array('is_array', false);
}Then you can do something like:
{if is_array}
{mytag}
{mytag1}
{/mytag}
{else}
{mytag}
{/if}Does that help? Sorry if I missed the point a bit, but that seems to be the issue you’re talking about I think :D
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.