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 -->
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With