forked from fex-team/fis-plus-smarty-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.head.php
More file actions
34 lines (32 loc) · 1.09 KB
/
compiler.head.php
File metadata and controls
34 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* 接管页面静态资源(css)的引入 head cssHook
*
* Copyright (c) 2015 Baidu EXP Team
* @see https://github.com/fex-team/fis-plus-smarty-plugin/blob/master/compiler.head.php
* @example
* {%head%}
* <meta charset="UTF-8" />
* <title>fis-plus</title>
* {%require name="demo:static/demo/demo.less"%}
* {%/head%}
* @package fis-plus smarty plugin
* @author Yang,junlong at 2015-07-14 16:06:44 commonts.
* @version $Id$
*/
function smarty_compiler_head($arrParams, $smarty) {
$strAttr = '';
foreach ($arrParams as $_key => $_value) {
$strAttr .= ' ' . $_key . '="<?php echo ' . $_value . ';?>"';
}
return '<head' . $strAttr . '>';
}
function smarty_compiler_headclose($arrParams, $smarty) {
$strResourceApiPath = preg_replace('/[\\/\\\\]+/', '/', dirname(__FILE__) . '/FISResource.class.php');
$strCode = '<?php ';
$strCode .= 'if(!class_exists(\'FISResource\', false)){require_once(\'' . $strResourceApiPath . '\');}';
$strCode .= 'echo FISResource::cssHook();';
$strCode .= '?>';
$strCode .= '</head>';
return $strCode;
}