1

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.

Huston Lopes
  • 622
  • 4
  • 17

5 Answers5

4

Have a look at these questions:

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:

  1. the relevant XML fragment of your Component
  2. the DWT fragment showing what you already tried
Community
  • 1
  • 1
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
3

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.

vikas kumar
  • 2,444
  • 15
  • 25
  • Isn't the question about looping through the Component Links themselves? Those are fields of the Component itself and thus ***are*** reachable with Tridion's standard DWT handling. – Frank van Puffelen Sep 07 '12 at 14:08
2

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 -->
Arjen Stobbe
  • 1,684
  • 9
  • 15
2

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:

  1. install the Dreamweaver Get eXtension on your Content Manager server, which will allow you to retrieve fields of linked components (amongst other things) using the @@Get(...)@@ syntax
  2. Use the "Get Linked Components" .Net TBB from the Generic SDL Tridion 2011 Template Building Blocks before your Dreamweaver Template, which will place the linked components into the templating package so that you can iterate over them directly
  3. Write your own .Net TBB to handle your specific business logic related to these links and output html (not recommended) or a named package item, items or array of items that you can handle from your DWT.
  4. Call another (nested) component template from your DWT with @@RenderComponentPresentation(Field, "tcm:x-xx-32")@@
  5. Any combination of the above
David Forster
  • 1,390
  • 9
  • 16
1

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" -->
Meenakshi
  • 599
  • 3
  • 13
  • i Think ,to get paragraphs0 you also need GetLinkedComponent TBB. – Ram Saurabh Sep 07 '12 at 13:12
  • If `paragraphs` is a Component Link field then indeed you do need a TBB to push the linked Components into the package. But from the naming it sounds like `paragraphs` is a multivalue field on the current context component, in which case you can look over the values using Tridion's built-in DWT support without any custom TBBs. – Frank van Puffelen Sep 07 '12 at 14:11