Recently in Movable Type Category

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)
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)

I've started a new site called Correspondence Notes. The site is about written communication as well as the tools and materials that go along with it. It contains lots of fawning over and geeking out about stationery and note cards. Like all of my sites Correspondence Notes is powered by Movable Type.

Nearly every article for Correspondence Notes contains at least one image. I use Movable Type's built in upload feature to upload images and add them to entries. The process is fine except for one step. By default Movable Type will upload images to your Site Root. That's great except I like my images to go into a subdirectory I like to call...images. I can of course, with the file upload utility, tell Movable Type to put the images into the images subdirectory. The problem is that the utility will not remember this preference. Every time I upload an image I have to tell Movable Type again to put the new image in the images directory instead of the Site Root. Though it only takes a few key strokes to type "images" into the subdirectory field it's a silly time waster since I want every single image I upload to go into that folder.

Since there isn't an option within the Movable Type user interface to make the file upload utility remember that I want my images to always go into the images subdirectory I decided to go straight to the source and make it happen. Please remember that if these steps break your copy of Movable Type I'm not the least bit responsible.

Configuring the upload utility to upload to the same subdirectory by default is actually quite simple. It only requires editing a single line of a single .tmpl file. However, if monkeying with an application's source code makes you really nervous I've heard there is a great plugin for improving Movable Type's file upload utility that only costs $10.

The file to edit is called asset_upload.tmpl. Assuming you have your Movable Type files in your cgi-bin the path to this file looks something like cgi-bin/mt/tmpl/cms/dialog/asset_upload.tmpl.

1. Download asset_upload.tmpl (I highly recommend you save a backup copy of it before you edit it)

2. Open asset_upload.tmpl and look for the following:
/ <input name="extra_path" id="extra_path" value="<mt:var name="extra_path" escape="html">" />

3. Change
value="<mt:var name="extra_path" escape="html">"
to
value="images"
where "images" is whatever subdirectory name you want your images uploaded to by default.

So your final code should look like this

/ <input name="extra_path" id="extra_path" value="images" />

4. Save and upload asset_upload.tmpl

5. Upload an image

uploadedit.png

You'll notice that the subdirectory field is still completely editable. So while Movable Type will, by default, now upload my images to the images subdirectory, should I want to upload a particular image to a different directory all I have to do is type a different name into the subdirectory text box.

| | Comments (0)