Where


When

Who

< Movable Type 3.1 Released | Main | QOTD 09/01/2004 >

August 31, 2004

MT 3.1 Subcategories

Movable Type 3.1 lets you now have subcategories, something that I'd kind of been wanting for a while. I'm currently using them and you can see some of the groupings of categories I have to the right. The code is after the 'more' link.

<h3>Categories</h3>
  <div class="right-text">
  <MTSubCategories>
  <MTSubCatIsFirst><ul <MTHasNoParentCategory>class="open parent"</MTHasNoParentCategory>     <MTHasParentCategory>id="ul_item<MTParentCategory>
    <$MTCategoryID$></MTParentCategory>" class="closed"</MTHasParentCategory>>     </MTSubCatIsFirst>

  <li
  <MTHasNoParentCategory> id="item<$MTCategoryID$>"</MTHasNoParentCategory>
  <MTHasParentCategory> id="item<MTParentCategory><$MTCategoryID$></MTParentCategory>
    _<$MTCategoryID$></MTHasParentCategory>">
    <MTHasSubCategories>[<a onclick="toggle('item<$MTCategoryID$>');">+</a>]
    </MTHasSubCategories>
  <MTHasNoSubCategories><MTHasNoParentCategory>[+]</MTHasNoParentCategory>
    </MTHasNoSubCategories>
  <a href="<MTCategoryArchiveLink>"><MTCategoryLabel> (<MTCategoryCount>)</a>
  <MTSubCatsRecurse>
  </li>
  <MTSubCatIsLast></ul></MTSubCatIsLast>
  </MTSubCategories>
</div>

If you view the source for this page you can see what it creates (along with the javascript it runs). There is documentation for this as part of the MT 3.1 documentation (also viewable here). If you are looking for other examples of the subcategories, you could start by checking out David Raynes' SubCategories, since the Movable Type 3.1 subcategories are based on his plugin. (Of course in the midst of typing this I realized I'd been talking to David earlier today on #joiito. Small world!)

Posted by snooze at August 31, 2004 7:30 PM