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:
Les plugins d'insertion sont utilisés pour implémenter les fonctions
qui sont appelées par les balises
{insert}
dans les templates.
string smarty_insert_name( |
$params, | |
&$smarty) ; |
array $params
;object &$smarty
;Le premier paramètre passé à la fonction est une tableau associatif d'attributs.
La fonction d'insertion est supposée retourner le résultat qui sera
substitué à la balise {insert}
dans le template.
Example 16.11. Plugin d'insertion
<?php /* * Smarty plugin * ------------------------------------------------------------- * Fichier : insert.time.php * Type : temps * Nom : time * Rôle : Insert la date/heure courante conformément * au format * ------------------------------------------------------------- */ function smarty_insert_time($params, &$smarty) { if (empty($params['format'])) { $smarty->trigger_error("insert time: missing 'format' parameter"); return; } return strftime($params['format']); } ?>