[英]Looping component links in an Embedded field
We have a "component A" , which has a multivalue field of type 'embedded field'. 我们有一个“组件A”,它具有类型为“嵌入式字段”的多值字段。 The embedded field in turn has a multivalue field of type ' Component Link '.
嵌入字段又具有类型为“ 组件链接 ”的多值字段。
This looks like: Component A -> Embedded Shcema Fields -> Component Links 看起来像: 组件A->嵌入式Shcema字段->组件链接
How to iterate and access the fields of 'Component Links 'in dreamweaver? 如何在Dreamweaver中迭代和访问“组件链接 ”的字段? Also the component field supports three different schemas and We want to check on these schema names in dreamweaver.
组件字段也支持三种不同的模式,我们想在Dreamweaver中检查这些模式名称。
I found this post useful. 我发现这篇文章很有用。 But more details would be indeed great.
但是更多细节确实很棒。
Have a look at these questions: 看一下这些问题:
How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1 如何在SDL Tridion 2011 SP1中的Dreamweaver TBB中处理嵌套的重复区域
Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable 在Dreamweaver TBB中检索链接组件的值-使其成为SiteEditable
And this page from the Tridion practice cookbook: 而Tridion练习手册中的以下页面:
They cover the most common problems you may have with accessing fields in a DWT. 它们涵盖了您在DWT中访问字段时可能遇到的最常见问题。
If these don't answer your question, update your question with: 如果这些不能回答您的问题, 请使用以下方法更新您的问题 :
You can easily iterate through component link of multi value embedded field but there is no direct way to get component link values, you have to use either dwt extension, or .net tbb. 您可以轻松地通过多值嵌入字段的组件链接进行迭代,但是没有直接方法来获取组件链接值,您必须使用dwt扩展名或.net tbb。 There are some available on sdltridionworld.com.
sdltridionworld.com上有一些可用的。
I did this earlier with nested template. 我之前使用嵌套模板来完成此操作。 You may also try nested/sub template from your main dwt tbb based on schema of component link field component in the loop.
您还可以根据循环中组件链接字段组件的模式,尝试从主dwt tbb中嵌套/子模板。
Also I would suggest to use razor templates. 我也建议使用剃刀模板。
You can iterate through the multi-value field paragraph in the embedded schema field paragraphs as follows: 您可以按以下步骤遍历嵌入式模式字段段落中的多值字段段落:
<!-- TemplateBeginRepeat name="Component.Fields.paragraphs" -->
<h2>@@Field.header@@ (@@TemplateRepeatIndex@@)</h2>
<!-- TemplateBeginRepeat name="Field.paragraph" -->
<p>@@Field@@</p>
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
As Vikas previously mentioned, repeating over the multivalued component link field of a multivalued embedded schema field is relatively simple. 正如Vikas前面提到的,在多值嵌入式架构字段的多值组件链接字段上重复相对简单。 Your DWT code should follow this form:
您的DWT代码应遵循以下格式:
<!-- TemplateBeginRepeat name="XML Name of Embedded Schema Fields" -->
<!-- TemplateBeginRepeat name="XML Name of multivalued Component Link field" -->
@@Field@@ - Should write out the TCM ID of your linked component
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
You can not, however, access the fields or schema details of these components with "out of the box" Dreamweaver Templates. 但是,您无法使用“开箱即用”的Dreamweaver模板访问这些组件的字段或架构详细信息。
You can: 您可以:
@@Get(...)@@
syntax @@Get(...)@@
语法检索链接组件的字段(以及其他内容) @@Get(...)@@
@@RenderComponentPresentation(Field, "tcm:x-xx-32")@@
@@RenderComponentPresentation(Field, "tcm:x-xx-32")@@
从DWT调用另一个(嵌套的)组件模板。 Please try using below code: 请尝试使用以下代码:
<!-- TemplateBeginRepeat name="paragraphs" -->
<!-- TemplateBeginRepeat name="Internal_Link" -->
<!-- TemplateBeginIf cond = "Internal_Link != ''" -->
<p> @@Component.ID@@ </p>
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
To check for zeroth component you can use below code: 要检查零分量,可以使用以下代码:
<!-- TemplateBeginRepeat name="paragraphs0.Internal_Link" -->
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.