count_words

Isto é usado para contar o número de palavras em uma variável.

Exemplo 5-7. count_words

index.php:

$smarty = new Smarty;
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->display('index.tpl');

index.tpl:

{$articleTitle}
{$articleTitle|count_words}

MOSTRA:

Dealers Will Hear Car Talk at Noon.
7




Guarde e Compartilhe

This page is powered by Blogger. Isn't yours?