【问题标题】:Is it possible to edit Component Links in SDL Tridion UI 2012?是否可以在 SDL Tridion UI 2012 中编辑组件链接?
【发布时间】:2012-06-02 16:26:58
【问题描述】:

向来自 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 启用组件链接)?

【问题讨论】:

  • 您的意思是希望链接组件的内容可编辑,还是链接本身可编辑?
  • 没关系 - 查看代码示例,它看起来像后者。

标签: tridion tridion-2011


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

    谢谢 Jeremy,手动添加 &lt;tcdl:ComponentField&gt; 标签解决了这个问题。

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

    <!-- TemplateBeginRepeat name="componentLink" --> 
        <!-- TemplateBeginIf cond="TemplateRepeatIndex<3" --> 
            <li>
                <tcdl:ComponentField name="componentLink">
                     <a tridion:href="@@Field@@">Link${TemplateRepeatIndex} </a>
                </tcdl:ComponentField>  
            </li>
        <!-- TemplateEndIf -->
    <!-- TemplateEndRepeat -->
    

    【讨论】:

      猜你喜欢
      • 2023-04-10
      • 1970-01-01
      • 2012-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多