Smarty:count_paragraphs

2018-10-12 15:10 更新

count_paragraphs

計算變量內(nèi)容有多少個段落。

Example 5.5. 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
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號