我应该使用tcdl,Tridion标签还是RenderComponentPresentation?

Alv*_*yes 5 tridion tridion-content-delivery

使用Tridion管理"全局"徽标

例如,要使用SDL Tridion管理网站范围的徽标及其文本元素,我希望它在一个组件中,由(动态)组件模板呈现,并由页面模板放置.我的要求包括:

  1. 徽标作为组件 -作为多媒体(mm)组件和链接,alt(即"home")的图像,以及可选容器组件中的其他文本
  2. 动态组件演示(DCP) - 无需发布每个页面即可管理徽标的标记演示和发布更改
  3. 可共享 - 能够在较低的出版物中本地化组件中的多媒体和文本,而不是模板

虽然主页上的徽标CP可以提供动态链接,但作者不需要将徽标作为组件展示(CP)放置在每个页面上.

RenderComponentPresentation(),TCDLTridion标签为"非CP"

对于这种无CP方法,我认为RenderComponentPresentation()或TCDL标签将是正确的"不可知"方法.一个比另一个更受欢迎吗?

例如,我的模板输出:

<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')@@
Run Code Online (Sandbox Code Playgroud)

这些在文件系统上转换为以下内容.

<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"/>
Run Code Online (Sandbox Code Playgroud)

每个都呈现传递方,以便用户在浏览器中看到正确的CP.

问题(S):

  1. 任何方法都会让我们从具有不可知格式的PT引用DCP,该格式可以检索呈现方,从而避免全站点发布.它不是真正页面,所以我们必须确保用动态CT发布徽标(在这种情况下它是html片段).我错过了什么吗?

  2. RenderComponentPresentation()优先于TCDL还是特定的表示端语法?我真的想要的任何理由<tridion:ComponentPresentation runat="server">呢?

编辑:我错过了Type="Dynamic"属性和值,也有一段时间以为RenderComponentPresentation没有创建正确的CP引用.

Bar*_*man 4

我认为,基本上您已经自己回答了第一个问题,除了您想如何在模板中编写它之外,您还可以在模板中找到 DCP。

我的偏好是使用它@@RenderComponentPresentation('tcm:7-1533','tcm:7-1532-32')@@,但实际上我不会将它与硬编码的 TCMURI 一起使用。我可能会编写一个 TBB,它从配置组件或发布元数据等位置读取多媒体组件 TCMURI 及其模板 URI,那么您的模板可能类似于:

@@RenderComponentPresentation(${LogoUri}, ${LogoTemplateUri})@@
Run Code Online (Sandbox Code Playgroud)

当使用 Dreamwever TBB 进行布局时,我会优先使用它。如果您使用另一种布局方式,那么下一个最好的办法是使用 TCDL 标签。事实上,要尝试保持模板代码不可知。我唯一会重新自己编写 tridion 控制代码的时候是当我无法通过其他方式获得它时。