Location: PHPKode > projects > Open Power Template > tests/Opt/instruction/selector_3.txt
The same, as test selector_1, but together with OPT:SHOW

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

>>>>expected.txt
OUTPUT

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

>>>>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