GETTING THE COUNT OF ELEMENTS IN AN ARRAY
For example, to get the number of elements in the array $loop, do the following:
php
{$loop|@count}php
{ if count($loop) > 0 }
$loopの要素数は1以上
{/if}COUNTING STRINGS
javascript
{assign var="hoge" value="Hello World"}
{$hoge}
{$hoge|count_characters}
{$hoge|count_characters:true} //White Space characterを含むかどうか
//Output data
Hello World
10
11Besides strings, modifiers are also available for paragraphs, sentences, and words. (These might be difficult to use with Japanese text.)
text
count_paragraphs
count_sentences
count_wordsRecommended Smarty Books
While Smarty only has older books, and only Kindle editions were available, the following is recommended for beginners.
📦Search Amazon US for related books and tools
PHP template engine development
Search Amazon US → (affiliate link). As an Amazon Associate, we earn from qualifying purchases.
