zblogphp的文章在调用标签时,可能会用到逗号隔开,要最后一个标签没有中文逗号,如何做呢?

zblogphp调用的文章标签:

{if $article.Tags}
  {php}$counts = count($article->Tags);$i=0;{/php}
  {foreach $article.Tags as $tag}
    {php}$i++{/php}
    {if $i == $counts}
      <a href="{$tag.Url}" class="tag-link">{$tag.Name}</a>
    {else}
      <a href="{$tag.Url}" class="tag-link">{$tag.Name}</a>,    {/if}
  {/foreach}{/if}

这样调用标签的话,可以做到以下的效果(中文逗号隔开,而最后一个标签没有中文逗号):

爱情,亲情,友情

zblogphp调用指定数量的文章标签(例子为调用3个):

{php}$i=0{/php}{if $article.Tags}
  {foreach $article.Tags as $key => $tag}
    {php}$i++{/php}
    {if $i < 4}
      <a href="{$tag.Url}" class="tag-link">{$tag.Name}</a>
    {/if}
  {/foreach}{/if}