[coldfusion] custom tag paried 与empty的区别

来源:互联网 发布:信用卡推荐 知乎 编辑:程序博客网 时间:2024/06/06 18:31

呵呵 我大概知道那个paried和 empty的关系了。
呵呵 我测试了一下

<!---Text.cfm  as a custom tag--->
Inside the custom tag<br>
cfoutput>
 nihao !
 #ucase(thistag.generatedcontent)#
</cfoutput><br>

<!---end--->


//


<!--- CFText.cfm as a call custom tag --->
<cf_text>
Between the pair<br>
</cf_text>


<!---end--->


假如没有</cf_text> 即为 empty时候
那么就会输出
Inside the custom tag
nihao !
Between the pair


而有</cf_text> 即为 paired时候
则会输出
Inside the custom tag
nihao !
Between the pair
Inside the custom tag
nihao ! BETWEEN THE PAIR


那么就是说明 当是empty的时候它执行一次且thistag.generatedcontent为空,这个为paired函数,还有就是它拥有 start mode,没有end mode
<cfif ThisTag.ExecutionMode EQ "start">
这样的可以执行
比如
<cfif ThisTag.ExecutionMode EQ "start">
Inside the custom tag<br>
<cfoutput>
 nihao !
 #ucase(thistag.generatedcontent)#

</cfoutput><br>
</cfif>

只是它对于没有</cf_text> 即为 empty时候 #ucase(thistag.generatedcontent)# 输出为空,即只有start mode模式的证明。


而对于有</cf_text> 即为 paired时候 在没有 mode (start,end)的条件判断的时候,它是执行两次的,也许这也是为什那么判断mode(start,end)的原因了.
还有就是看了 nested custom tag 感觉到这个paired有递归的作用,有进有出。

呵呵 暂时了解也就这么多,呵呵 大概是理解到这么程度了,我不知道对不对 只是自己的理解。
呵呵

 

 


如果想知道很清楚 http://coldfusion.sys-con.com/node/41856有很详细的说明

 

原创粉丝点击