Location: PHPKode > projects > Open Power Template > tests/Opt/instruction/selector_2.txt
The test checks the opt:selector instruction and custom item name field

>>>>templates/test.tpl
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<opt:selector name="sect" test="ajtem">
<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', 'ajtem' => 'foo'),
	array('val1' => 'C', 'val2' => 'D', 'ajtem' => 'bar'),
	array('val1' => 'E', 'val2' => 'F', 'ajtem' => 'foo'),
	array('val1' => 'G', 'val2' => 'H', 'ajtem' => 'bar'),
);
Return current item: Open Power Template