Say welcome to the new requested feature for templating engine: “foreach_exec”.
It is combination of the “foreach” iterator tag and “execute” class method calling tag.
It works by executing given argument as execute input and then iterates over result array.
As you can understand, called method should return array.
Aim of this tag is to leverage wrapping code amount and speed optimization to avoid
extra big arrays passing into templates by $replace array members.
Examples:
imagine result of the called method _class('unittest2')->_callme2 == array('k1' => 'v1', 'k2' => 'v2'); and now template code: {foreach_exec(unittest2,_callme2)} _{_key}={_val}_ {/foreach_exec} {foreach_exec(@object,_callme2)} _{_key}={_val}_ {/foreach_exec} {foreach_exec(unittest2,_callme2)} _{_key}={_val}_ {elseforeach} no rows {/foreach_exec}