Location: PHPKode > projects > Open Power Template > tests/Opt/instruction/selector_5.txt
Test, whether the instruction works with separators given as tags.

>>>>templates/test.tpl
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<opt:selector name="sect">
<opt:separator>,</opt:separator>
<opt:foo>FOO: {$sect.val1},{$sect.val2}</opt:foo>
<opt:bar>BAR: {$sect.val1},{$sect.val2}</opt:bar>
</opt:selector>
</opt:root>

>>>>expected.txt
OUTPUT

>>>>result.txt
FOO: A,B,
BAR: C,D,
FOO: E,F,
BAR: G,H

>>>>data.php
$view->sect = array(
	array('val1' => 'A', 'val2' => 'B', 'item' => 'foo'),
	array('val1' => 'C', 'val2' => 'D', 'item' => 'bar'),
	array('val1' => 'E', 'val2' => 'F', 'item' => 'foo'),
	array('val1' => 'G', 'val2' => 'H', 'item' => 'bar'),
);
Return current item: Open Power Template