count_sentences[計(jì)算句數(shù)]
This is used to count the number of sentences in a variable.
計(jì)算變量里句子的數(shù)量。
Example 5-6. count_sentences
index.php:
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.');
$smarty->display('index.tpl');
index.tpl:
{$articleTitle}
{$articleTitle|count_sentences}
OUTPUT:
Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
2
|
|