Removing Tag from Final Tag Link
Posted: 27 September 2008 08:10 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

I’ve got Tag module running smoothly on my site and have the tag links under every entry. However, the code that I’m using to produce the tag links actually puts a comma after EVERY tag. This works great when there’s more than one tag or for all tags but the last one but it looks kinda strange on the last tag because it leaves a ‘hanging comma.’ You can see what I mean in the attached image. How do I go about adding some logic so that a comma doesn’t display after the last tag entry?

My code is below and the picture is attached:

Tags: {exp:tag:tags entry_id="{entry_id}" type="weblog" backspace="2" orderby="clicks" sort="desc"}
<a href="{path='blogs/tag'}{websafe_tag}" title="{tag_name}">{tag}</a>,
{/exp:tag:tags}

Image Attachments
Picture 2.png
Profile
 
 
Posted: 27 September 2008 08:36 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Surprisingly, change your code to this: smile

Tags: {exp:tag:tags entry_id="{entry_id}" type="weblog" backspace="2" orderby="clicks" sort="desc"}
<a href="{path='blogs/tag'}{websafe_tag}" title="{tag_name}">{tag}</a>, {/exp:tag:tags}

(moved {/exp:tag:tags} onto same line)

 Signature 
Profile
 
 
Posted: 27 September 2008 08:39 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

Thanks. That was easy enough!

Profile