What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
E' usato per contare il numero di frasi contenute in una variabile.
Example 5.6. count_sentences
<?php $smarty = new Smarty; $smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.'); $smarty->display('index.tpl'); ?>
Dove index.tpl è:
{$articleTitle} {$articleTitle|count_sentences}
Questo stamperà:
Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe. 2