定界符函数

说明: 左定界符 <{ , 右定界符}>,由定界符组成的函数认为是定界符函数, 例如:<{include }>.

使用定界符函数时,会调用base/lib/view/compilers/tramsy.php文件中的parseTag($function, $arguments)函数。

1.例如: 我们使用<{url action=topshop_ctl_item@storeItem}>, 打印输出变量信息$function=string(3) "url"$arguments=array(1) { ["action"]=> string(28) "'topshop_ctl_item@storeItem'"}, 函数存在变量$this->buildinTags中,修改函数字符串为parseTagUrl, 在本文件调用parseTagUrl函数,并传入参数$arguments

定界符函数

调用文件

<{url }>

本文件的parseTagUrl函数

<{include }>

本文件的parseTagInclude函数

2.例如: 我们使用<{input type="category" name="item[cat_id]" shop_id=$shopId value=$item.cat_id callback="categoryCallback"}>, 判断$this->_compile_ui_function($function, $arguments, $_result)为true, 调用base/lib/component/ui.php中的input($params)函数。

定界符函数

调用文件

<{input }>

base/lib/component/ui.phpinput函数

3.例如: 我们使用<{require file="block/header.html"}>, 判断$this->_compile_compiler_function($function, $arguments, $_result)为true, 调用site/lib/view/compiler.php中的compile_require函数。

定界符函数

调用文件

<{require }>

site/lib/view/compiler.phpcompile_require函数

4.例如,我们使用<{header app=topc}>$this->_compile_custom_function($function, $arguments, $_result)判断为true,根据情况调用不同文件。

定界符函数

调用文件

<{header }>

topc/lib/site/view/helper.phpfunction_header函数

Last updated