Location: PHPKode > projects > Open Power Template > tests/Opt/function/contains_2.txt
Testing the contains() function.

>>>>templates/test.tpl
<?xml version="1.0" ?>
<opt:root>
<opt:if test="contains($vars, 3)">CONTAINS<opt:else>DOES NOT CONTAIN</opt:else></opt:if>
<opt:if test="contains($vars, 2)">CONTAINS<opt:else>DOES NOT CONTAIN</opt:else></opt:if>
</opt:root>

>>>>data.php
$view->vars = new ArrayObject(array(
	'v1' => 1,
	'v2' => 3,
	'v3' => 5
));

>>>>expected.txt
OUTPUT

>>>>result.txt
CONTAINS
DOES NOT CONTAIN
Return current item: Open Power Template