10

来自 Tridion 星球的所有人类的一个大大的“嗨” :)。

我正在尝试使组件链接在 SDL Tridion UI 2012 中可编辑。

我有一个组件包含多值组件链接作为字段之一。

当我在 DWT 中添加以下内容时

<!-- TemplateBeginRepeat name="componentLink" -->
 <!-- TemplateBeginIf cond="TemplateRepeatIndex<3" -->
  <li> 
   <a href="#" tridion:href="@@RenderComponentField(FieldPath+"componentLink",TemplateRepeatIndex)@@">
    Link${TemplateRepeatIndex}
   </a>  
  </li> 
 <!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->

结果在模板生成器内部,我得到了以下信息:

<li><a href="#" tridion:href="<tcdl:ComponentField name="componentLink" index="0">tcm:8-625</tcdl:ComponentField>">Link0</a></li> 
<li><a href="#" tridion:href="<tcdl:ComponentField name="componentLink" index="1">tcm:8-626</tcdl:ComponentField>">Link1</a></li> 
<li><a href="#" tridion:href="<tcdl:ComponentField name="componentLink" index="2">tcm:8-627</tcdl:ComponentField>">Link2</a></li> 

正如预期的那样,页面级别的“默认完成操作”发生错误

无法找到 tridion:href 的正确值

是否需要在之前的某个操作中提取 C# TBB 中的组件链接或存在任何其他方式来解决此问题(为 SDL Tridion UI 启用组件链接)?

4

2 回答 2

10

在我的“新 UI VM”中,我的设计中有以下代码:

<tcdl:ComponentField name="LinkText">
  <a tridion:href="@@Component.Fields.Target@@">${LinkText}</a>
</tcdl:ComponentField>

链接的组件在新 UI 中是可编辑的。处理 tcdl:ComponentField 以将适当的上下文编辑指令包装在链接周围。您应该能够很容易地将其转换为您的代码......

于 2012-05-28T10:02:01.550 回答
6

谢谢杰里米,手动添加<tcdl:ComponentField>标签解决了这个问题。

这是在页面级别正确解析组件链接的最终代码:

<!-- TemplateBeginRepeat name="componentLink" --> 
    <!-- TemplateBeginIf cond="TemplateRepeatIndex<3" --> 
        <li>
            <tcdl:ComponentField name="componentLink">
                 <a tridion:href="@@Field@@">Link${TemplateRepeatIndex} </a>
            </tcdl:ComponentField>  
        </li>
    <!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
于 2012-05-28T11:29:14.037 回答