count_paragraphs
count_paragraphs 用于计算变量中的段落数。
基本用法
{$myVar|count_paragraphs}
示例
<?php
$smarty->assign('articleTitle',
"War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
);
模板代码如下:
{$articleTitle}
{$articleTitle|count_paragraphs}
输出结果:
War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
2
另请参阅 count_characters、
count_sentences 和
count_words。