Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access fields in a template of components inside components inside components

I've a problem here. The structure that I have at the moment is:

ComponentA
   FieldA1 - textField
   CombonentsB - componentLink (multi-value)
       FieldB1 - textField
       ComponentC - componentLink
           FieldC1 - textField

Now I am trying to place ComponentA with Template on a page. I am using DWT Templating. What I need is to access FieldC1 in the template.

I've already added the "Add Linked Components To Package" TBB in TemplateA. I think it is identical to this one: http://sdltridionworld.com/community/extension_overview/addcompstopackage.aspx I can access FieldB1 in my template but not the fields further down in the hierarchy.

Do I have to write another TBB that includes the whole hiearchy, or should it work as expected and my access code is just wrong?

<!-- TemplateBeginRepeat name="ComponentsB" -->
@@ComponentC.Fields.FieldC1@@
<!-- TemplateEndRepeat -->

What can I do to make it work? Are there any other solutions then writing a new TBB?

=========== SOLUTION ============

After Nickoli Roussakov told me about the DGX, I managed to implement it correctly. Here the code:

<!-- TemplateBeginRepeat name="ComponentsB" -->
    @@Get("ComponentsB[${TemplateRepeatIndex}].Fields.ComponentC.Fields.FieldC1")@@
<!-- TemplateEndRepeat -->
like image 958
Egi Avatar asked Nov 01 '12 13:11

Egi


1 Answers

GetLinkedComponents works only on the first level of component nesting because you can't go deeper than that with DWT syntax. Your options are to write a custom tbb that renders out the output needed down from componentB, or try Nuno's DGX extension (also on sdltridionworld) instead of GetLinkedComponents.

like image 103
Nickoli Roussakov Avatar answered Sep 20 '22 02:09

Nickoli Roussakov