2012-10-09 18 views

回答

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()); 
%> 

C#

ComponentPresentationFactory cp_factory = new ComponentPresentationFactory(publicationid); 
ComponentPresentation cp = cp_factory.GetComponentPresentation(CompID, TEMPLATEID); 
if (cp != null) 
    { 
    Output = cp.Content; 
} 
6

有多种方式来显示动态演示在页面上:

  • 最简单的一个标记您的动态CT"Allow on Page Using Dynamic Assembly",那么你会能够将其作为非动态CT嵌入到您的网页上

enter image description here

相关问题