例如,要使用SDL Tridion管理网站范围的徽标及其文本元素,我希望它在一个组件中,由(动态)组件模板呈现,并由页面模板放置。我的要求包括:
作者不应该将徽标作为组件演示文稿(CP)放在每个页面上,尽管主页上的徽标CP可以提供动态链接。
“非CP”的RenderComponentPresentation()
,TCDL
或Tridion
标签对于这种无CP方法,我认为RenderComponentPresentation()或TCDL tag将是正确的“不可知”方法。一个比另一个更受欢迎吗?
例如,我的模板输出:
<h3>By tridion: (ASP.NET) tag</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>By tcdl: tag</h3>
<tcdl:ComponentPresentation
PageURI="@@Page.ID@@"
type="Dynamic"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>by render component presentation</h3>
@@RenderComponentPresentation('tcm:7-1533','tcm:7-1532-32')@@
这些会在文件系统上转换为以下内容。
<h3>By tridion: (ASP.NET) tag</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>By tcdl: tag</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>by render component presentation</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
每个呈现传递方,以便用户在浏览器中看到正确的CP。
任何方法都会让我们从具有不可知格式的PT引用DCP,该格式可以检索呈现方,从而避免全站点发布。它不是 on 页面,因此我们必须确保使用动态CT(在这种情况下是html片段)发布徽标。 我错过了什么吗?
RenderComponentPresentation()是否优先于TCDL或特定的演示文稿方法?我真的想要<tridion:ComponentPresentation runat="server">
的原因是什么?
编辑:我错过了Type="Dynamic"
属性和值,也是因为RenderComponentPresentation没有创建正确的CP引用。
答案 0 :(得分:4)
基本上你已经回答了我自己的第一个问题,除了你想在你的模板中写出你在那里有你的DCP。
我的偏好是使用@@RenderComponentPresentation('tcm:7-1533','tcm:7-1532-32')@@
,但我实际上不会将它与硬编码的TCMURI一起使用。我可能会编写一个TBB来读取多媒体组件TCMURI及其模板URI,例如配置组件或发布元数据,然后您的模板看起来像:
@@RenderComponentPresentation(${LogoUri}, ${LogoTemplateUri})@@
将Dreamwever TBB用于布局时,我会将其作为首选项使用。如果您使用的是另一种布局方式,那么下一个最好的方法就是使用TCDL标签。确实试图让你的模板代码不可知。我唯一能够自己回复写出tridion控制代码的时候,就是我无法用另一种方式来实现它。