About

Posted January 6, 2005
← Go to home page
← See all articles

Article

MT3 Subcategories: Not working

UPDATE: Turns out I was trying too hard. Way too hard. I’ve solved the problem, and put together a quick tutorial on using subcategories in MT3.

* * *

I was going to write about how I implemented a bunch of tweaks on this site, but I must first complain about the way sub-categories are handled in MovableType 3 and ask for your help.

For a project for the Friends of Lake Wingra, I am putting together a library of documents. The documents fit into one of six main categories — five of those have sub categories.

I am trying to display, for each main category:

<h4>Name of main category</h4>
<ul>
    <li>Name of subcategory 1</li>
    <li>Name of subcategory 2</li>
    <li>Name of subcategory 3</li>
</ul>

That seems easy enough, right? That seems like the sort of thing you might want to do with subcategories, right? I guess not.

Disclaimer: The following will be terribly confusing to anyone who isn’t familiar with MovableType tags. Don’t say I didn’t warn you.

Here’s what my template code looks like for that little chunk:

 1  <MTSubCategories>
 2    <MTHasNoParentCategory>
 3      <h4><$MTCategoryLabel$></h4>
 4    </MTHasNoParentCategory>
 5    
 6    <MTHasNoSubCategories>
 7      <MTHasParentCategory>
 8        <MTSubCatsIsFirst><ul></MTSubCatsIsFirst>
 9        <li><$MTCategoryLabel$></li>
10        <MTSubCatsIsLast></ul></MTSubCatsIsLast>
11      </MTHasParentCategory>
12    </MTHasNoSubCategories>
13     
14    <$MTSubCatsRecurse$>
15
16  </MTSubCategories>

That seems like a lot of work, but it makes good sense. Let me explain the logic:

As you may have guessed, it doesn’t work — the output is totally messed up (p.s. check the source).

So, here are my questions for any bright MT gurus that made it this far: 1. What did I do wrong? (maybe it was something dumb, like a typo) 2. How can I fix it? 3. Has anyone gotten this to work correctly? Is there any good documentation on this functionality?

I’ve wasted about 3 hours on this already, so I really appreciate any help you can provide. Thanks!