5

我这里有问题。我目前的结构是:

ComponentA
   FieldA1 - textField
   CombonentsB - componentLink (multi-value)
       FieldB1 - textField
       ComponentC - componentLink
           FieldC1 - textField

现在我正在尝试将 ComponentA 与模板放在页面上。我正在使用 DWT 模板。我需要的是访问模板中的 FieldC1。

我已经在 TemplateA 中添加了“将链接组件添加到包”TBB。我认为它与这个相同: http : //sdltridionworld.com/community/extension_overview/addcompstopackage.aspx 我可以在我的模板中访问 FieldB1,但不能访问层次结构中更下方的字段。

我是否必须编写另一个包含整个层次结构的 TBB,或者它是否应该按预期工作而我的访问代码是错误的?

<!-- TemplateBeginRepeat name="ComponentsB" -->
@@ComponentC.Fields.FieldC1@@
<!-- TemplateEndRepeat -->

我该怎么做才能让它发挥作用?除了编写新的 TBB 之外,还有其他解决方案吗?

=========== 解决方案 =============

在 Nickoli Roussakov 告诉我有关 DGX 的信息后,我设法正确实施了它。这里的代码:

<!-- TemplateBeginRepeat name="ComponentsB" -->
    @@Get("ComponentsB[${TemplateRepeatIndex}].Fields.ComponentC.Fields.FieldC1")@@
<!-- TemplateEndRepeat -->
4

1 回答 1

8

GetLinkedComponents 仅适用于组件嵌套的第一级,因为您无法比使用 DWT 语法更深入。您的选择是编写一个自定义 tbb,从 componentB 渲染出所需的输出,或者尝试使用 Nuno 的 DGX 扩展(也在 sdltridionworld 上)而不是 GetLinkedComponents。

于 2012-11-01T14:06:49.900 回答