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:
Posizione del Parametro | Tipo | Obbligatorio | Default | Descrizione |
---|---|---|---|---|
1 | intero | No | 4 | Stabilisce di quanti caratteri deve essere l'indentazione. |
2 | stringa | No | (uno spazio) | Questo è il carattere usato per l'indentazione. |
Questo modificatore effettua un'indentazione della stringa ad ogni riga, per default di 4 caratteri. Come parametro opzionale si può specificare di quanti caratteri deve essere l'indentazione. Si può indicare anche, come secondo parametro opzionale, quale carattere usare per l'indentazione (usare "\t" per il tabulatore).
Example 5.11. indent
<?php $smarty = new Smarty; $smarty->assign('articleTitle', 'NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25.'); $smarty->display('index.tpl'); ?>
Dove index.tpl è:
{$articleTitle} {$articleTitle|indent} {$articleTitle|indent:10} {$articleTitle|indent:1:"\t"}
Questo stamperà:
NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25. NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25. NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25. NJ judge to rule on nude beach. Sun or rain expected today, dark tonight. Statistics show that teen pregnancy drops off significantly after 25.