Matrix Version: V5.5
I’m trying to make it easier to load images onto our pages using keywords to include the relevant title, caption and alt text. When I create a lightbox gallery via nested content, this code works perfectly and pulls in the correct information for each image:
<a href="./?a=%asset_assetid%" title="%asset_attribute_title%">
<div>
<img src="./?a=%asset_assetid%" alt="%asset_attribute_alt%"/>
</div>
<p>%asset_attribute_caption%</p>
</a>
My problem is when I try similar code to add just one image directly to a page (not nested). The following code works fine but I need to manually add the asset number 5 times to make sure it targets the correct information from the image asset.
<a href="./?a=12345" title="%globals_asset_attribute_title:12345%">
<div>
<img src="./?a=12345" alt="%globals_asset_attribute_alt:12345%"/>
</div>
<p>%globals_asset_attribute_caption:12345%</p>
</a>
It would be awesome if I could set the asset number once and it was automatically used in all 5 locations that it is required.
So my question is, does anyone know if there is a way that I can write this code and only have to write the asset number one time (without using asset listing or nested content)?
Thanks