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.uri.php
More file actions
23 lines (23 loc) · 852 Bytes
/
compiler.uri.php
File metadata and controls
23 lines (23 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
/**
* 获取静态资源地址
*
* Copyright (c) 2015 Baidu EXP Team
* @see https://github.com/fex-team/fis-plus-smarty-plugin/blob/master/compiler.uri.php
* @example
* <img src="{%url name="demo:widget/test/img/test.png"%}" />
* @package fis-plus smarty plugin
* @author Yang,junlong at 2015-07-14 16:29:29 commonts.
* @version $Id$
*/
function smarty_compiler_uri($arrParams, $smarty) {
$strName = $arrParams['name'];
$strCode = '';
if($strName){
$strResourceApiPath = preg_replace('/[\\/\\\\]+/', '/', dirname(__FILE__) . '/FISResource.class.php');
$strCode .= '<?php if(!class_exists(\'FISResource\', false)){require_once(\'' . $strResourceApiPath . '\');}';
$strCode .= 'echo FISResource::getUri(' . $strName . ',$_smarty_tpl->smarty);';
$strCode .= '?>';
}
return $strCode;
}