Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

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:

Sites Using Smarty

Check reviews of PHP Web Hosting, compatible with Smarty Templates

Largest classified with thousands of ads at Shoppok

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy wedding dresses on SiteSteer.com - Best Online Wedding Dress Store

Candy Crush Cheats

Tired of playing games? Visit the Game Supply to Sell World of Warcraft Accounts.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Filtros de salida

Cuando el template es invocado a través de display() o fetch(), su salida puede ser enviada a través de uno o mas filtros de salida. Este es diferente a los postfilters porque los postfilters operan en los templates compilados antes de ser salvados en disco, y los filtros de salida operan en la salida del template cuando este es ejecutado.

Los Filtros de Salida pueden ser registrado o cargados del directorio de plugins usando la función load_filter() o configurando a variable $autoload_filters. El Smarty pasara la salida como el primer argumento, y espera que la función retorne el resultado del procesamiento.

Example 15.4. Usando un filtro de salida de template


<?php
// ponga esto en su aplicación
function protect_email($tpl_output, &$smarty)
{
    $tpl_output =
       preg_replace('!(\S+)@([a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,3}|[0-9]{1,3}))!',
                    '$1%40$2', $tpl_output);
    return $tpl_output;
}

// registra el outputfilter
$smarty->register_outputfilter("protect_email");
$smarty->display("index.tpl");

// Ahora cualquier ocurrencia de una direcci&oacute;n de email en la salida
// del template tendra una simple protecci&oacute;n contra spambots
?>


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 11 plus 11? (Are you human?)

Sponsors [info]

UK Web Hosting @webhost.uk.net
Best Web Hosting @rshosting.com
Web Hosting UK @webhostinguk.com
Unlimited Web Hosting @infrenion.com
App Entwicklung @morphodo.com
Buy from China @dhgate.com
dissertationteam.com
Buy Web Hosting @buy-hosting.net
WordPress Hosting Hub @wphostinghub.net