2013-04-13 32 views
0

我是SDL Tridion的新手,只是探索內容交付。 我用下面的代碼在TBB我pagetemplate如何從brokerdb獲取componentPresentation?

<% ComponentPresentationFactory factory = new ComponentPresentationFactory("tcm:0-6- 1"); 
ComponentPresentation ps = factory.GetComponentPresentationFactory("tcm:6-9841","tcm:6-9858-32"); 
if(ps!=null) 
{ 
string output=""; 
    output=ps.Content; 
    Literal1.Text=output; 
} 
%> 
    <asp:Literal id="Literal1"Text="" runat="server"<</asp:Literal> 

我已經發表了組件和使用動態組件模板。 但是沒有內容反映在頁面上。我錯過了什麼?

+0

嗨,是我錯了,或者,你的問題有沒有關係'簡單直接媒體層(SDL)'爲標有「SDL」?另請說明你正在使用的語言。 – 2013-04-13 21:06:07

+0

此外,您可能需要使用http://tridion.stackexchange.com上的Tridion專用堆疊式交換站來查看Tridion問題。 –

回答

2

嘗試去除空白的URI中醫認爲:0-6-1您的代碼應閱讀factory.GetComponentPresentation("tcm:6-9841","tcm:6-9858-32");

+0

最後檢查asp:Literal控件中的拼寫錯誤 - 它沒有正確關閉。 –

+1

找到了原因,與我通過的發佈ID不匹配。 – roop