June 08, 2004

MT categories

The category organization in MovableType is interesting, which causes a little pain if you wish to manipulate it by hand (as I did).

The mt_category table holds the category ids and descriptions but the main bits for entry category data are in the mt_placement table (there seem to be some leftovers from previous arrangements in the mt_entry table).

Column Value Description
placement_entry_id numeric blog post id which post?
placement_blog_id numeric blog id which blog?
placement_category_id numeric category id id of the category
placement_is_primary 0|1 primary category?

Category based rendering would just select based on placement_category_id and iterate over those. When building a list of categories for a particular post, you simply select based on placement_entry_id and placement_blog_id.

Most people aren't going to need to go playing around at the DB level to shovel around categories, but I needed to (because it's always easier to go do it the hard way, right?) and I didn't really see this written down anywhere. Now it is.

Posted by Dave at June 8, 2004 11:21 PM
Comments