如何在tridion页面中包含动态组件演示?

P.M*_*hna 4 tridion tridion-2011

如何在页面中包含/引用动态组件模板.我创建了一个动态CT并发布了它,但想在页面中呈现它的演示文稿.请建议.

提前致谢,

vik*_*mar 12

有很多方法可以在页面上添加动态演示文稿.

直接方法 - 为此,您的组件演示应该允许在页面上.使用动态装配检查允许页面.在页面上添加与所有其他人一样的演示文稿.

代码方法 - 您可以使用API​​直接从代理存储中获取组件表示.这是相同的示例代码.

*<%@ Import Namespace="Tridion.ContentDelivery.DynamicContent"%>
<%
  ComponentPresentationFactory factory = new ComponentPresentationFactory();
  ComponentPresentation ps = factory.getComponentPresentation("CompID","TEMPLATEID");
  Response.Write(ps.Content);
%>
JSP example:

<%@ page import="com.tridion.dynamiccontent" %>
<% 
  ComponentPresentationFactory cpf = new ComponentPresentationFactory("tcm:0-1-1"); // Publication URI
  // Component URI and Component Template URI
  ComponentPresentation componentPresentation = cpf.getComponentPresentation("CompID", "TEMPLATEID");
  out.println(componentPresentation.getContent());
%>
Run Code Online (Sandbox Code Playgroud)

C#

ComponentPresentationFactory cp_factory = new ComponentPresentationFactory(publicationid);
ComponentPresentation cp = cp_factory.GetComponentPresentation(CompID, TEMPLATEID);
if (cp != null)
  {
     Output = cp.Content;
}
Run Code Online (Sandbox Code Playgroud)


Pun*_*ero 6

有多种方法可以在页面上显示动态演示文稿:

  • 最简单的是将动态CT标记为"Allow on Page Using Dynamic Assembly",然后您就可以将其作为非动态CT嵌入页面

在此输入图像描述