/** * Smarty {css} block plugin * * Name: css<br> * Purpose: 提供css合并去重功能 * @link * @author Yancan <*****@*****.**> * @param array * @param Smarty * */ function smarty_block_cssholder($params, $content, &$smarty, &$repeat) { if ($repeat) { return; } if (empty($content)) { return ''; } foreach (explode("\n", $content) as $v) { if (empty($v)) { continue; } $v = trim($v); $v = ltrim($v, '/'); Template::CssHolder($v); } }
function smarty_outputfilter_cssholder($output, &$smarty) { return preg_replace('/<!--tpl:cssholder-->/', Template::CssHolder(), $output, 1); }