Reputation: 622
We have a "component A" , which has a multivalue field of type 'embedded field'. The embedded field in turn has a multivalue field of type 'Component Link'.
This looks like: Component A -> Embedded Shcema Fields -> Component Links
How to iterate and access the fields of 'Component Links'in dreamweaver? Also the component field supports three different schemas and We want to check on these schema names in dreamweaver.
I found this post useful. But more details would be indeed great.
Upvotes: 1
Views: 2127
Reputation: 1390
As Vikas previously mentioned, repeating over the multivalued component link field of a multivalued embedded schema field is relatively simple. Your DWT code should follow this form:
<!-- 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.
You can:
@@Get(...)@@
syntax@@RenderComponentPresentation(Field, "tcm:x-xx-32")@@
Upvotes: 2
Reputation: 599
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" -->
Upvotes: 1
Reputation: 2444
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. There are some available on 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.
Also I would suggest to use razor templates.
Upvotes: 3
Reputation: 1684
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 -->
Upvotes: 2
Reputation: 600006
Have a look at these questions:
How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1
Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable
And this page from the Tridion practice cookbook:
They cover the most common problems you may have with accessing fields in a DWT.
If these don't answer your question, update your question with:
Upvotes: 4