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

Prefilters

Los prefilters de Template son funciones de PHP que corren sus templates antes de ser compilados. Esto es bueno para procesar por adelantado sus templates y remover comentarios no deseados, vigilando a las personas que coloquen en sus templates, etc.

Los Prefilters pueden ser registrado o cargado del directorio de plugins usando la función load_filter() o por la configuración de la variable $autoload_filters.

El Smarty pasara el código fuente del template como el primer argumento, y espera que la función le retorne el código fuente del template resultante.

Example 15.2. usando un prefiltro prefilter de template


<?php
// ponga esto en su aplicación
function remove_dw_comments($tpl_source, &$smarty)
{
    return preg_replace("/<!--#.*-->/U","",$tpl_source);
}

// registrar el prefilter
$smarty->register_prefilter("remove_dw_comments");
$smarty->display("index.tpl");
?>

Esto eliminara todos los comentarios en el codigo del template.


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 17 plus 13? (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