【问题标题】:Access fields in a template of components inside components inside components访问组件内组件内组件模板中的字段
【发布时间】:2012-11-01 13:38:15
【问题描述】:

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

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 -->

【问题讨论】:

    标签: tridion tridion-2011


    【解决方案1】:

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

    【讨论】:

    • 非常感谢,我设法用 DGX 实现了这个要求!
    猜你喜欢
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    • 2017-04-19
    • 2017-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多