Location: PHPKode > projects > Open Power Template > tests/Opt/instruction/grid_7.txt
Test if the grid works with snippets - part two.

>>>>templates/test.tpl
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<opt:root>
<opt:snippet name="snip">
FOO:{$snip.foo}
</opt:snippet>
<opt:grid name="items" cols="3">
:ROW START
<opt:item opt:use="snip">
</opt:item>
<opt:emptyItem>
Empty
</opt:emptyItem>
:ROW END
</opt:grid>
</opt:root>

>>>>data.php
$view->items = array(
	array('foo' => 'item 1'),
	array('foo' => 'item 2'),
	array('foo' => 'item 3'),
	array('foo' => 'item 4'),
	array('foo' => 'item 5'),
	array('foo' => 'item 6'),
	array('foo' => 'item 7'),
	array('foo' => 'item 8'),
	array('foo' => 'item 9')
);

>>>>expected.txt
OUTPUT

>>>>result.txt
:ROW START
FOO:item 1
FOO:item 2
FOO:item 3
:ROW END
:ROW START
FOO:item 4
FOO:item 5
FOO:item 6
:ROW END
:ROW START
FOO:item 7
FOO:item 8
FOO:item 9
:ROW END
Return current item: Open Power Template