{capture assign='primaryStr'} {foreach from=$row.primaryKey item='value' key='field' name='primaryKey'} {$field}: {$value|htmlspecialchars}{if !$smarty.foreach.primaryKey.last}, {/if} {/foreach} {/capture} {if $row.viewUrl} {$primaryStr} {else} {$primaryStr} {/if}