Get Smarty

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Check reviews of PHP Web Hosting, compatible with Smarty Templates

Filtres de post-compilation

Les filtres de post-compilation sont des fonctions PHP que vos templates exécutent après avoir été compilés. Les filtres de post-compilation peuvent être soit déclarés, soit chargés depuis les répertoires des plugins en utilisant la fonction load_filter() ou en réglant la variable $autoload_filters. Smarty passera le template compilé en tant que premier paramètre et attendra de la fonction qu'elle retourne le résultat de l'exécution.

Example 15.3. Utilisation d'un filtre de post-compilation de templates


<?php
// mettez celà dans votre application
function add_header_comment($tpl_source, &$smarty)
{
    return "<?php echo \"<!-- Créé par Smarty ! -->\n\"; ?>\n".$tpl_source;
}

// enregistre le filtre de post-compilation
$smarty->register_postfilter('add_header_comment');
$smarty->display('index.tpl');
?>

  

Votre template Smarty index.tpl ressemblera, après compilation à :


<!-- Créé par Smarty ! -->
{* reste du contenu du template... *}

  

Voir aussi register_postfilter(), les pré-filtres et load_filter().

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 18 plus 20? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
email marketing @ActiveCampaign
broadband deals @BroadbandGenie
Best UK Web Hosting @webhost.uk.net
Reliable UK and US Web Hosting @rshosting.com
Cheap US and UK Web Hosting @infrenion.com
I.T Certification Exams @pass-guaranteed.com
Certification Practice Tests @firsttrycertify.com
Certification Practice Exam Questions @ace-it-certifications.com
Broadband Speed Test @broadbandspeed.co.uk
bulk email software @americaint.com
ASP.NET hosting @aspnethosting.co.uk