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 -->

1 Answer 1

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 -->
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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