Combining entries from two weblogs (Movable Type 3.3x)

Okey, let’s make it fast. “How to combined two weblog entries in Movable Type?” The answer is: easy. I just tried it last night. These are some general information about my Movable Type installation:

  • Main weblog – the archives (individual, date-based, and category) are published dynamically. The other pages are built statically.
  • Bookmark section (this is new) – published statically. But, I am thinking of publish it dynamically. Not that hard I suppose.
  • Using Movable Type 3.31

There are some tutorials you can follow to produce combined entries listing. Here are two famous methods:

I use the first method. Why? I find that MTSQL plugin does not work with 3.31. Correct me if I am wrong. Just download the plugins, and upload to your Movable Type plugins directory.

Added later: Enda told me that MTSQL works without problem You can see how he combines main weblog and quicklinks in his blog.

The ideas. Hint! Hint!

  • Producing a file having a list of combined entries (order by date of post).
  • The file should be rebuilt when each blog posts a new entry.
  • Generate different entry outputs for each weblog. In the list, the bookmark (link) wlll only display the MTEntryBody field; the main weblog has most elements (MTEntryTitle, MTEntryBody, MTEntryMore, etc).
  • include(); is power.

Getting Started

First, create new template files in both blogs. You can use my template file if you want to (and feel free to modify it). For the output setting, I prefer to publish it in the second weblog (bookmark) main folder. Let’s say, we use use two-in-one.php file as the output file. So, the file will be located here: bookmark/two-in-one.php. For the first weblog (main weblog), my MT publishes that file in the same location. The idea: two-in-one.php will be rebuilt when a new entry posted in the first and/or second weblog.

Second step: modify the main index file (here, the index.php published by main weblog).

  • Change everything under <MTEntries> and </MTEntries> container with the two-in-one.php file.
  • Since I publish the file using .php extension, I simply use PHP include();. Something like this: <?php include("bookmark/two-in-one.php"): ?>

Rebuild your index file, and everything should work.

Understanding combined entries file

If you use my two-in-one.php template file, here are some additional information about the template tags:

  • <MTGlobalEntries lastn="15" include_blogs="1,3"> — This tag will ask Movable Type to produce last 15 entries from blogID 1 and 3.
  • <MTIfEqual a="[MTBlogID]" b="3"><ul class="bookmarklist"></MTIfEqual> — This is the header container for blogID 3 (the bookmark). I use this, because I display the bookmarks in a real list (using <li>
  • <MTIfEqual a="[MTGetVar name='lastBlogID']" b="3"></ul></MTIfEqual> — This is the footer container for the list of bookmark.

Well, that’s a quick and dirty solution I use here in my weblog. Let me know if you have problems with that. Enjoy!