Location: PHPKode > projects > Open Power Template > tests/Opt/instruction/foreach_2.txt
Test checks the basic iteration features.

>>>>templates/test.tpl
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Print array values -->
<opt:root>
<opt:foreach array="$data" value="val">
{@val}::
</opt:foreach>
</opt:root>

>>>>expected.txt
OUTPUT

>>>>result.txt
Value 1::Value 2::Value 3::Value 4::
>>>>data.php
	$view->data = array(
		'key1' => 'Value 1',
		'key2' => 'Value 2',
		'key3' => 'Value 3',
		'key4' => 'Value 4'
	);
Return current item: Open Power Template