Help - Search - Members - Calendar
Full Version: Category And Subcategory Of The Current Entry
Movable Type Community Forum > Using Movable Type > Categories and Entry Tags
hass
I need some quick help
If I have an entry that is under category A and subcategory A2, how do I display that (and only that -- not all the subcategories under all categories -- just the category and subcategory of the current entry)
sconnor


Hass, if you know the entry has one category and one subcategory, here's how I did this in a breadcrumb module in the entry template:

<MTIfNonEmpty tag="EntryCategory">
<h3><a href="#">Home</a><span class="crumb"><MTEntryCategories glue="&nbsp;"><a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$></a></MTEntryCategories></span></h3>
</MTIfNonEmpty>



I found it much trickier to make a category list with subcategories while allowing folks to surf the listings by subcategory. Don't know if this will help you in a future application, but here it is:

<mt:IfArchiveType archive_type="Category">
<mt:HasParentCategory>
<mt:ParentCategories>
<mt:ParentCategory>
<div class="<mt:CategoryBasename />">
<h2><mt:CategoryLabel /></h2>
<ul>
<mt:SubCategories>
<li><a href="<mt:CategoryArchiveLink />"><mt:CategoryLabel /></a></li>
</mt:SubCategories>
</ul>
</mt:ParentCategory>
</mt:ParentCategories>
<mt:Else>
<div id="sechead" class="<mt:CategoryBasename />">
<h2><span></span><mt:CategoryLabel /></h2>
<ul>
<mt:SubCategories>
<li><a href="<mt:CategoryArchiveLink />"><mt:CategoryLabel /></a></li>
</mt:SubCategories>
</ul>

</mt:HasParentCategory>





QUOTE (hass @ Apr 29 2008, 11:58 AM) *
I need some quick help
If I have an entry that is under category A and subcategory A2, how do I display that (and only that -- not all the subcategories under all categories -- just the category and subcategory of the current entry)


This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.