Comunitatea PHP Romania
 

 
Postfilters

Postfilters

Template postfilters are PHP functions that your templates are ran through after they are compiled. Postfilters can be either registered or loaded from the plugins directory by using the load_filter() function or by setting the $autoload_filters variable. Smarty will pass the compiled template code as the first argument, and expect the function to return the result of the processing.

Example 15-3. Using a template postfilter

<?php
// put this in your application
function add_header_comment($tpl_source, &$smarty)
{
    return 
"<?php echo \"<!-- Created by Smarty! -->\n\"; ?>\n".$tpl_source;
}

// register the postfilter
$smarty->register_postfilter('add_header_comment');
$smarty->display('index.tpl');
?>

The postfilter above will make the compiled Smarty template index.tpl look like:

<!-- Created by Smarty! -->
{* rest of template content... *}

See also register_postfilter(), prefilters and load_filter().

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Top membri

Pirahna Pirahna
la birou
carco carco
Bucuresti
Birkoff Birkoff
Bucuresti
mihaitha mihaitha
Sibiu
Mascka Mascka
Braila
gabysolomon gabysolomon
Bacau
whooper whooper
Toronto ON
raul_ raul_
dechim dechim
Drobeta Turnu Severin
Amenthes Amenthes

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Gas Suppliers | Nissan Titan Performance Parts | Mortgage Calculator | Remortgages | Xecuter 3 Mod Chip
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis