Get Smarty

Donate

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Visit www.sport-kick.com for cheap soccer cleats, sneakers and Soccer Jerseys updates

Advertisement

count_sentences

计算变量内容有多少个句子。 每个句子必须以点号、问号或者感叹号结尾。(.?!)

Example 5.6. count_sentences


<?php

$smarty->assign('articleTitle',
                 'Two Soviet Ships Collide - One Dies.
                 Enraged Cow Injures Farmer with Axe.'
                 );

?>

   

模板是:


{$articleTitle}
{$articleTitle|count_sentences}

   

输出:


Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
2

   

参见 count_characters, count_paragraphscount_words.

Comments
No comments for this page.

Advertisement