简体   繁体   中英

how to fetch componentPresentation from brokerdb?

I am new to SDL Tridion,just exploring content delivery. I used below code in the TBB of my pagetemplate

<% 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>

I have published that component and used a dynamic component template. But no content is reflecting on the page.Did i missed something?

尝试从uri tcm:0-6-1中删除空格,你的代码应该是factory.GetComponentPresentation("tcm:6-9841","tcm:6-9858-32");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM