count_words
count_words 用于计算变量中的单词数。
基本用法
{$myVar|count_words}
示例
<?php
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
模板代码如下:
{$articleTitle}
{$articleTitle|count_words}
输出结果:
Dealers Will Hear Car Talk at Noon.
7