October 2007 Archives

When my friend and I were first discussing the MT:OtherBlog tag I mentioned that it seemed to do the exact same thing as MT:MultiBlog. I couldn’t, and still can’t, figure out why there would be two different tags with redundant functions but it turns out MT:MultiBlog has a couple more bells and whistles than MT:OtherBlog that make it much more functional.

In the comments of my post on MT:OtherBlog 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 this blog and Correspondence Notes again as a real world example. I want the content I’m pulling from Correspondence Notes into the footer of this blog 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 my footer here at On a path will always be rebuilt when a new entry is saved at Correspondence Notes and thus my footer here will always have the most up to date content. Sweet.

| | Comments (2)

That title is a little misleading because you can't actually change the default font in Apple's Pages. I find that very frustrating because I find Gill Sans to be much more pleasing to the eye than Helvetica. Although you can't change the default font you can implement a simple work around that achieves the same effect as say setting a new default font in Microsoft Word would.

1. Open a blank document in Pages
2. Set your font settings to whatever you want the new default to be
3. Save this document as a template
4. Go into Preferences (General Preferences specifically)
5. In the "For New Documents" section click the button for "Use template:"
6. Click the choose button and select the template you saved a few steps ago

goodfont.png

| | Comments (11)
The new templates and template structure in Movable Type 4 streamline and simplify the process of making site wide changes to your blog. Well that’s what they do once you actually understand the templates and template structure. But understanding how the templates work together and digesting the tag soup that swims in each of those templates? Not exactly simple. So at the suggestion of a friend I thought I’d create a series of basic tutorials that help explain the templates and template structure. The tutorials will begin at a relatively basic entry level.

Instead of just breaking down templates line by line I thought it would be easier and more practical to look at templates in the context of actually doing something. You don’t really need to understand every single line of code if you know where and how to make the changes to accomplish what you want. For this first tutorial we’ll be making changes to the sidebar. Specifically we’re going to remove a widget we don’t want and add Google AdSense ads in the sidebar, after the archive content, on every page of a blog.

Before we get to actually editing any templates I can’t recommend highly enough that you download and install the Template Shelf plugin. If you’re going to spend any time at all editing your templates this plugin will make your life much easier. For this tutorial we’re only going to be editing one template. But it’s not unlikely that you’ll be needing to hop back and forth between multiple templates and modules in the future and this plugin makes that much, much simpler.

I’ve set up a brand new blog to serve as an example of the work done in this tutorial. I selected the minimalist light blue style and a two column (wide-thin) layout from Stylecatcher in Movable Type. Since we’ve got a two column layout the template we’re going to be modifying is the Sidebar - 2 Column Layout. This template is actually a template module. What’s a module? The best analogy I can think of is that a template module is like a backpack. You’ve got a whole bunch of stuff (all the code for the sidebar) you need to get somewhere (in the sidebar of all the pages on your blog) and it’s much easier to put all of that stuff in a backpack (a template module) and then unpack it when you get to where you’re going.

So instead of having to put all your sidebar code into every template (main index, individual archive pages, monthly archives, etc) you just reference the particular module that contains the code like so <$MTInclude module="Sidebar - 2 Column Layout"$>.

Out of the gate this is what the sidebar looks like.
beforeedits.png
| | Comments (2)

There are a lot of new and useful tags in Movable Type 4.0. I'm slowly working my way through figuring some of them out and putting them to use. One of my favorites new tags is mt:OtherBlog. I actually hadn't played with it at all until a friend mention his frustration with figuring it out since the documentation for this tag is a little scant. So I spent a little time with it and am glad I did.

mt:Otherblog makes it easy to pull and post content from other blogs in your Movable Type installation. Previously I'd use a php include to pull content from another blog. Take a look at this site's footer. See where it says "from my Reading List"? That content is being pulled from my Reading List blog via a php include. I haven't switched it to the mt:OtherBlog method yet. The content from Correspondence Notes however is being pulled via mt:OtherBlog.

If you can do what mt:OtherBlog does with a php include what's the big deal? Efficiency and simplicity. For the php include method you must setup a special template for the first blog that spits out only the content you want to pull into the second blog. For Reading List the code in that template looks like this

<MTEntries lastn="1">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a> <br/>
<$MTEntryExcerpt$>
</MTEntries>

Then you must call up the content from that special template in your second blog's template
<?php require("/home/serverpath/html/books/specialtemplate.html"); ?>
And you of course need to make sure all the pages you want to display this content on have the .php extension, not .html.

With mt:Otherblog you don't have to do anything at all to the blog you want to pull content from and your standard .html extensions are just fine. All you have to do is figure out that blog's id number and then insert the following code (or some variation on it depending on what you specifically want to display) into the blog that will be displaying that content.

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

The important variable for pulling content from other blogs is include_blogs="#". Key here is blogs, not blog. When I first started fooling with it I was trying <mt:OtherBlog include_blog="#"> with much frustration. Since you're using include_blogs you can of course pull from multiple blogs by simply
using comma separators (include_blogs="3, 15", etc).

| | Comments (4)