count_paragraphs修飾子 文章の数を数える

変数内の文章の数を数える。

PHP

$smarty->assign('hoge', "it is fine today.¥n Good morning!");
$smarty->assign('hoge2', "it is fine today.¥n¥n Good morning!");

テンプレート

{$hoge}
{$hoge|count_paragraphs}
{$hoge2}
{$hoge2|count_paragraphs}

出力

it is fine today.
Good morning!
2
it is fine today.

Good morning!
2

関連記事

スポンサーリンク

border-right-style 右ボーダーのスタイルを指定する

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る