2012-07-17 50 views
0
<cfparam name="attributes.mytestvalue" default="0"> 
<cfdump var="#attributes#"> 

<!--- Attributes are there. ---> 

<cfdocumentSection> 
    <cfdocumentitem type="footer"> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem type="footer"> 
</cfdocumentSection> 

<!--- Attributes are not there. ---> 

爲什麼會發生這種情況?這是一個已知的錯誤?<cfdocumentItem>中缺少的屬性>

回答

2

據\ WEB-INF \ cftags \ META-INF \ taglib.cftld,cfdocumentsection和cfdocumentitem實施爲定製標籤本身,因此可能有自己的屬性範圍,從而掩蓋你投入屬性範圍值。

你可以試試這個:

<cfdocumentSection> 
    <cfdocumentitem type="footer" mytestvalue="#attributes.myTestValue#> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem type="footer"> 
</cfdocumentSection> 

或許這樣的:

<cfset attribs={type="footer", myTestValue=0}> 
<cfdocumentSection> 
    <cfdocumentitem attributeCollection="#attribs#"> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem> 
</cfdocumentSection> 

而且,雖然我不認爲這是這裏的問題,你已經得到了TYPE = 「頁腳」屬性上cfdocumentItem的結束標記,這是沒有必要的

+0

對不起,type =「footer」是剪切粘貼錯誤,因爲實際代碼位於不同的系統上。 – 2012-07-17 14:23:41

0
<cfset request.myTestValue=attributes.myTestValue> 

<cfdocumentSection> 
    <cfdocumentitem type="footer" mytestvalue="#request.myTestValue#> 
     <cfdump var="#attributes#"> 
    </cfdocumentitem type="footer"> 
</cfdocumentSection> 

這個固定不過現在我知道爲什麼它不幹活G。謝謝Barnyr。