Hi everyone,
I need to visualize in the template “article_details.tpl” the values that are inserted in the metadata of the article under “Subjects” and “Supporting Agencies”.
I activated the field in Workflow Settings → Metadata and then following the example of the “keywords” I tried to do it this way:
{if !empty($publication->getLocalizedData('agencies'))}
<div class="item published">
<div class="label">
{translate key="submission.supportingAgencies"}
</div>
<div class="value">
{foreach name="agencies" from=$publication->getLocalizedData('agencies') item="agencies"}
{$agencies|escape}{if !$smarty.foreach.agencies.last}{translate key="common.commaListSeparator"}{/if}
{/foreach}
</div>
</div>
{/if}
but something is not correct because it does not display anything, where am I wrong?
Thanks
Bye
Tiziano
Hi @Tiziano
For “Supporting Agencies”:
{if !empty($publication->getLocalizedData('supportingAgencies'))}
<div class="item published">
<div class="label">
{translate key="submission.supportingAgencies"}
</div>
<div class="value">
{foreach name="supportingAgencies" from=$publication->getLocalizedData('supportingAgencies') item="supportingAgency"}
{$supportingAgency|escape}{if !$smarty.foreach.supportingAgencies.last}{translate key="common.commaListSeparator"}{/if}
{/foreach}
</div>
</div>
{/if}
For “Subjects”:
{if !empty($publication->getLocalizedData('subjects'))}
<div class="item published">
<div class="label">
{translate key="common.subjects"}
</div>
<div class="value">
{foreach name="subjects" from=$publication->getLocalizedData('subjects') item="subject"}
{$subject|escape}{if !$smarty.foreach.subjects.last}{translate key="common.commaListSeparator"}{/if}
{/foreach}
</div>
</div>
{/if}
Best,
Bozana
3 Likes