{foreach from=$items item=foo name='xxx'} {if $foo}{$foo}{/if} {if !$smarty.xxx.last},{/if} {/foreach}