Search code examples
phpmysqldatabasecontent-management-systemmovabletype

Movable Type: Category relationships


I would like to know the relationships of Category in MovableType CMS.

Currently, I have 2 categories named "Category A" and "Category B". And I have Blog named "Blog A". "Category A" and "Category B" are in "Blog A". When I create "Entry 1" under "Blog A", I have chose "Category A" for that "Entry 1". But when I checked in database, I could see that column name "entry_category_id" under "mt_entry" table is "NULL".

What I'm trying to do is, I would like to retrieve every entries under "Category A". Please let me know if I should search in different table under MovableType database for those entries under specific Category.

Thanks in advance.


Solution

  • The column mt_entry.entry_category_id is unused (I guess it's a remnant from an old schema version). The categories associated to an entry are stored in the mt_placement table.

    To retrieve every entries under a specific category, first find the category ID (it's unique across all blogs, either look it up via the category listing using the id parameter in the URL or search the mt_category table), then do a query like this one:

    SELECT placement_entry_id from mt_placement WHERE placement_category_id = <your category numeric ID>;
    

    You'll get a list of entry IDs associated to that category.