Call of Cthulhu Knights of the Dinner Table Online
Here is an example of its use:
<MT>
ChangeLog:
« If only I could make money doing this | Main | Perl version of the Comment Queue hack »Here it is. Download one of the following files, unpack it, and place sub_cats.pl in your plugins/ directory and mt-sc.cgi in your base MT directory. mt-sc.cgi will probably need to be chmod'ed to 755 so it can be executed.
It provides the following tags:
Here are some usage examples that I've been using on my site:
Category List
<MTSubCategories>
<MTSubCatIsFirst><ul></MTSubCatIsFirst>
<li>
<MTCategoryLabel>
<MTSubCatsRecurse>
</li>
<MTSubCatIsLast></ul></MTSubCatIsLast>
</MTSubCategories>
Category Archive File Name (e.g. category/sub-category/sub-category/index.php)
archives/<MTParentCategories glue="/"><MTCategoryLabel
dirify="1"></MTParentCategories>/index.php
Category Breadcrumbs for an Entry
<MTEntryCategories glue=", ">
<MTParentCategories glue = "-> ">
<a href="<$MTCategoryArchiveLink$>"
title="<$MTCategoryDescription$>"><$MTCategoryLabel$></a>
</MTParentCategories>
</MTEntryCategories>
I also replaced all the MTEntries containers in my Category Archive Template with MTEntriesWithSubCategores to include all the sub-categories for the given category. You can also use the category list example in your Category Archive Template to produce a list of sub-categories.
To define how your categories relate to each other, just load up mt-sc.cgi in your web browser. With the dinky little interface I threw together, you can define the category -> sub-category relationship for your categories. The code will make sure that you do not define a category to be a sub-category of itself, but there are currently no safeguards against creating a sub-category loop (e.g. A is a sub-category of B which is a sub-category of A). If one of those is created, MT may get stuck in an infinite loop during your rebuilds (and therefore fail when the usual CGI timeout is hit).
Hopefully some (maye even most?) of that made sense. If you do not understand any part of this, please let me know and I will try and explain things more thoroughly.
( Note: This requires MT 2.6 or higher, and uses MT::PluginData, so the Storable perl module must be installed by your host )
Update: (2003-09-24 06:54)
I have added in some extra functionality to mt-sc.cgi thanks to Jay. Now it will print out a quick category heirarchy while you are editing. I still need to implement some kind of loop checking though. Anyways, enjoy!
Movable Type subcategories conquered whilst working with frostbite.
David Raynes: SubCategories Archives
David Raynes: SubCategories 1.2
David Raynes: SubCategories 1.0
David Raynes: SubCategories v0.3
David Raynes: SubCategories v0.4
Subcategories Defined in Dictionary cif_mm.dic
Open Directory Editorial Guidelines - Subcategories
Radio and Television Subcategories [Ad*Access]
TrackBack URL for this entry:
http://mt.rayners.org/mt-tb.cgi/234
How do I delete a parent/child category relationship? I set A to B via mt-sc.cgi when I meant to set B to A. I was able to set B to A after the fact, but I can't seem to get rid of the original A to B.
Does this require a MYSQL hack job,i.e. SQL delete query from the plugin data table?
Shouldn't the front-end be able to delete a relationship? please help.