« Create a Contact Form using MT4 | Main | Rotating Banner Ads in MT Using PHP »

Putting MT:MultiBlog to Work

Last week on my personal blog I discussed how to put the MT:OtherBlog tag to use and compared that tag with using PHP includes to create the same functionality.

In the comments of that post J. Brotherlove reminded me of one serious advantage PHP includes have over using MT:OtherBlog: automatic updating. If I’m pulling content from Blog 1 with a PHP include into Blog 2 whenever Blog 1 is updated the pulled content is automatically updated on Blog 2. This isn’t the case when using MT:OtherBlog. When I update Blog 1 the pulled content on Blog 2 will not be updated until Blog 2 is rebuilt (either indexes or the entire blog depending on how you’ve got it set up). So after round 1 the score card finds MT:OtherBlog winning in the ease of use category but PHP includes winning in terms of actual useful functionality. So, a tie.

But then (again in the comments of my post on MT:OtherBlog) David Raynes dropped some incredibly helpful knowledge that turned PHP includes and MT:OtherBlog both into also-rans. Turns out David originally developed the MT:OtherBlog functionality as a plugin for an older version of Movable Type. With Movable Type 4.0 this functionality was packaged into the application as MT:MultiBlog. While on the surface MT:MultiBlog and MT:OtherBlog do the same thing (namely allow you to easily pull content from one blog into another blog) the former has a serious advantage.

The MT:MultiBlog tag gets its functionality from the MT:MultiBlog plugin and that plugin has rebuild triggering options. Whereas when using MT:OtherBlog I would have to manually rebuild Blog 2 to force it to pull the most recent content from Blog 1 when using MT:MultiBlog I can set a rebuild trigger to automatically rebuild.

Let me use my personal blog On a path and content from Correspondence Notes as a real world example. I want the content I’m pulling from Correspondence Notes into the footer of On a path to always be up to date. Using MT:MultiBlog I have two steps to making that happen. First step is getting the code in order:

<mt:MultiBlog include_blogs="1">
<MTEntries lastn="2">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
<$MTEntryExcerpt$><p>
</MTEntries>
</mt:MultiBlog>

This is of course almost identical to the code used in the MT:OtherBlog example. David rightly points out that this code could be condensed but I prefer writing it out like I have here. Just a personal preference so feel free to do it however you like.

The second step is to configure a rebuild trigger using the MT:MultiBlog plugin. Go to plugin configurations for Blog 2.

Picture 1.png

Select MT:MultiBlog 2.0, click settings and then Create Rebuild Trigger. Choose the blog that will be triggering the rebuild (in my example it’s Correspondence Notes) and configure it. I chose to rebuild the On a path indexes whenever a Correspondence Notes entry is saved.

Picture 2.png

Now the Correspondence Notes content in the On a path footer will always be rebuilt when a new entry is saved at Correspondence Notes and thus the On a path footer will always have the most up to date content. Sweet.

This a slightly modified version of an article that originally appeared at On a path

Comments (5)

helene:

Thank you so much! So much clearer than the movableType documentation. It took me 5 minutes with these steps. I'm happy happy :)

diana:

I was wondering if you are able to have a feed through this multiblog. Here's the code I'm using:

<mt:entries include_blogs="3,6,9">
<MTEntries lastn="40">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
<$MTEntryBody$><p>
</mt:entries>
</mt:entries>
</mt:entries>

It pulls the entries technically, but they aren't headed properly with their title and timestamp, so I'm wondering if this might be why it can't pull it into a feed?

Diana, that's pretty complex code (and not exactly correct) - you should be able to do something much simpler, like so (assuming MT4):

<MTEntries include_blogs="3,6,9" lastn="40">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>
<$MTEntryBody$>
</MTEntries>

Just cut and paste into your feed template, replacing the section where the MTEntries code resides, and you're done (you could also create a new one, if you want multiple feeds).

diana:

Chad, the code you gave is still doing pretty much what my code was doing. Now I'm starting to wonder if its not so much the multiblog code that's preventing me from being able to create a feed:

Multiblog test

The blog page is ok enough, but the feed page shows up empty. And yes, I am using MT4.

Hi Diana -

Not sure what you mean.

First, the code I mentioned is meant to do what your code is doing, just in a simpler way (though your code does have some errors in it, it may work - it is a code snippet, so I can't tell exactly).

Second, the link you sent looks fine, as does your feed. So as to 'empty', I can't say. All this code will do is pull in the content from blogs 3, 6 and 9, assuming they exist on the same installation. If they don't, it's not going to do anything - but that's a function of MultiBlog, not the template code you have here.

If that's not what you're after, you'll need to add some more detail so we can help.

Post a comment

(If you haven't left a comment here before, your comment may need to be approved before will appear on the entry. Thanks for waiting.)