tips and tricks for movable type

dangling separator when listing multiple categories
April 06, 2002

Solution posted by Wes Cowley in this Community Forum topic.

It's also a great example of how to use the MTSetVar and MTGetVar tags.

<MTSetVar name="catsep" value="">
<MTEntryCategories>
<MTGetVar name="catsep">
<a href="<MTBlogURL>cat_<MTCategoryLabel dirify="1">/"><MTCategoryLabel></a>
<MTSetVar name="catsep" value=", ">
</MTEntryCategories>

"The separator is inserted before the category name, not after. Initially it's set to an empty string, but after the first category it's set to a comma. That way, if there's a second category the separator will appear between them but won't appear for only one category."

07.04.02: The "glue" attribute now available in MT solves the original problem. Here's what I use in my templates to separate my multiple category labels:

<MTEntryCategories glue=" | ">
<a href="<MTCategoryArchiveLink>" onMouseOver="self.status='more in this category';return true" onMouseOut="self.status='';return true"><MTCategoryLabel lower_case="1"></a>
</MTEntryCategories>

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 0
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/23)