4

I have Component with multivalued Multimedia Component link field named "list". Each Multimedia Component has its own metadata ("thumbnail" and "altText"). I need to write a DWT TBB to extract those metadata values. I am using DGX in templating.

I tried this code but its rendering the image not metadatas.

<!-- TemplateBeginRepeat name="list" -->                                    
<div>
<a href="@@Get("Fields.list[${TemplateRepeatIndex}].Id.Metadata.thumbnail")@@">
<img alt="@@Get("Fields.list[${TemplateRepeatIndex}].Id.Metadata.altText")@@" src="@@Get("Fields.list[${TemplateRepeatIndex}].Id")@@"/>
</a>
</div>
<!-- TemplateEndRepeat -->
4

Id is a property of the linked component, not a reference to the component itself - You already have that with

Fields.list[${TemplateRepeatIndex}]

Try removing the Id from your href and alt attributes.

<!-- TemplateBeginRepeat name="list" -->                                    
<div>
<a href="@@Get("Fields.list[${TemplateRepeatIndex}].Metadata.thumbnail")@@">
<img alt="@@Get("Fields.list[${TemplateRepeatIndex}].Metadata.altText")@@" src="@@Get("Fields.list[${TemplateRepeatIndex}].Id")@@"/>
</a>
</div>
<!-- TemplateEndRepeat -->

In fact, if you look at the samples on the Dreamweaver Get eXtension page on SDL Tridion World, it looks like Id is returned by default, so you can probably remove it from your src attribute also, like this:

<!-- TemplateBeginRepeat name="list" -->                                    
<div>
<a href="@@Get("Fields.list[${TemplateRepeatIndex}].Metadata.thumbnail")@@">
<img alt="@@Get("Fields.list[${TemplateRepeatIndex}].Metadata.altText")@@" src="@@Get("Fields.list[${TemplateRepeatIndex}]")@@"/>
</a>
</div>
<!-- TemplateEndRepeat -->
| improve this answer | |
  • 1
    Syntax for DGX can be found here: sdltridionworld.com/community/extension_overview/… – Kunal Apr 2 '14 at 11:28
  • I used that as well but it shows "undefined" for that particular field – Coder Apr 2 '14 at 11:50
  • I think Davids code should work, but you could also try @@GetFromItem(Fields.list[${TemplateRepeatIndex}], "Metadata.altText")@@ – Bart Koopman Apr 2 '14 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.