2 Jan 2004
Integrated Quicklinks Tutorial
As promised, here’s a brief tutorial for MoveableType on combining regular weblog entries with quicklinks (basically, entries from two blogs each using a different template) into one column.
(1/10/04 Update: I’ve also created a second tutorial that combines the entries in a different way, which I’m now using on this website)
The assumption is that you have two weblogs set up in MT, one of which you use for short links. In my “quicklink” weblog, I store the link’s description in the EntryTitle field, the URL in the EntryBody field, and any additional description in the EntryMore field (meaning, I have to use a different template than for my other blog).
I’m also assuming that if you’re smart enough to try this, you know your way around MT Plugins, CSS, and inserting a chunk of text into page using PHP or SHTML, etc, so I won’t have to explain everything.
- Download and install the GlobalListings and MTCompare plugins.
(Stephan’s site is temporarily down, so here’s GlobalListings.pl, which you should put in your plugins folder.)
- Step deleted 1/8/04: I had originally given instructions for adding a new tag (MTCurrentBlogID) to the Global Listings plugin, until someone pointed out in the comments below that MTBlogID (which is built in) can be used for the same purpose.
- In your main weblog, create a new template called “Combined Entries.” The output file should be called “combined.txt” and you should link the template to a file named “combined.tmpl”.
Paste the following code into the template box:
Here’s the basic idea: As we loop through the entries from the two weblogs, we use the <MTBlogID> tag to specify which template we’ll use to display the entry. It’s likely that the ID of your main weblog is 1 and your quicklink blog is 2 — if not, you’ll need to adjust the numbers in the template above.
Because I wanted to group my quicklinks together in a box, I use the the <MTIfEqual>s and <MTIfNotEqual>s to insert formatting before and after groupings of entries (if you don’t want to do this, you can easily remove all those other conditional tags).
- So that the include file (combined.txt) will be rebuilt when you add to/edit your other quicklink blog, create a template in that blog with the same information (linked to the same combined.tmpl file).
Make sure you specify the directory path correctly. For example, if your Quicklink blog is in a subdirectory of your regular weblog (i.e. “/quicklinks”), you may need to use “../combined.txt” (and “../combined.tmpl”) to point the files in the proper direction.
- Finally, we include the combined.txt file in your main weblog page. I use the following PHP code:
<? include("combined.txt"); ?>
If you don’t have PHP or SHTML, you can try the MTIncludePlus plugin to insert combined.txt into your main weblog page.
And there you have it. A fairly simple way to combine entries from two or more weblogs using different templates.
This site has a useful tutorial on how to use MTSQL to do the same thing, which gives you a bit more flexibility. Also, I posted a tutorial on my site detailing how to combine monthly archives and category archives from multiple weblogs.
Frankie Dintino | 7 Jan 2004