Re: [SMARTY] CSS Interfering with Smarty
| From: | Rémy Dufour | Date: | Thu, 16 Oct 2003 20:38:47 +0000 |
| Subject: | Re: [SMARTY] CSS Interfering with Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10364@lists.php.net to get a copy of this message | ||
I use this "prefilter" function to replace any javascipt or style tag with the correct
{literal}...{/literal}
function smarty_prefilter_literalScriptAndStyle(&$tpl_source, &$smarty)
{
// <javascript>
$pattern[] = '~<script\b(?![^>]*smarty)(.*)</script>~iU';
$replace[] =
'<!--{literal}--><script$1>$2</script><!--{/literal}-->';
// <style>
$pattern[] = '~<style\b(?![^>]*smarty)(.*)</style>~iU';
$replace[] =
'<!--{literal}--><style$1>$2</style><!--{/literal}-->';
return preg_replace($pattern, $replace, $tpl_source);
} // function
$smarty->register_prefilter('smarty_prefilter_literalScriptAndStyle');
Rémy Dufour
http://www.propage.com