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

>>>>templates/test.tpl
<?xml version="1.0" ?>
<opt:root>
{countSubstring('foo bar joe bar goo', 'bar')}
{countSubstring($strings, 'bar')}
</opt:root>

>>>>expected.txt
OUTPUT

>>>>data.php
$view->strings = array(
	'foo bar joe',
	'moo goo hoo',
	'bar bar foo'
);

>>>>result.txt
2
3
Return current item: Open Power Template