February 2010 Archives

When working on the development version of an existing, large Movable Type blog with hundreds or thousands of entries, it can sometimes be useful to 'empty out' the blog.  Say you want to test some tweaks to your archive templates, but you don't want to be republishing five years worth of entries after every little change.  So you go to the 'Manage Entries' screen and...
One of the great advantages of Movable Type is that you can easily host multiple blogs on the same installation, each with their own set of users (or even sharing users between them).  Each blog has its own folder on the webserver where output is produced, and each blog can have a totally different look-and-feel.  But what about a number of 'shared' screens, like the signup form for commenters, or user profile pages?  
As you may or may not know, the <mt:entrybody> tag (and some others) has the very usefull 'words' attribute that allows you to automatically trim its output to a specified number of words.  Want to show just 20 words?  Just put in <mt:entrybody words="20"> and you are done.  Unfortunately, this 'words' attribute is not one of the 'global modifiers' that work on any tag.  Tough luck?  Not at all...
In the comments to my recent post about generating thumbnails with your entry titles in Movable Type, a commenter named 'harrods' asked if it was possible to display the height and/or width of the generated thumbnails, so he could use this info in the height and width attributes of an <img> tag.  Well, "Harrod S." (or "Mr. Harrods"), are you in luck.  This is indeed possible!
Overall, Movable Type has some pretty decent standard templates.  Optimized for SEO, standardized class names and IDs, nicely separated in modules...  There is some learning involved if you want to understand all the conditional stuff that is going on under the hood, but once you know what you are doing they are quite easy to maintain and customize.  Not to mention the styles that are already available.
Movable Type's WYSIWYG editor makes it super easy to upload one or more images in any post.  Resizing them and moving them around a bit is also a snap in most cases.  But what if you want to display the titles of your most recent entries somewhere else, preferably with a thumbnail pic of one of the images in the post?  Are you stuck with also displaying the entire body of the post to get at the image(s)?  Of course not!

Movable Type 4.34 is out

| 2 Comments | No TrackBacks |
Release notes are here.  Mostly minor bugfixes and some security stuff, but worth the upgrade I think.
I already explained earlier what to make of cryptic "Can't call method ... on an undefined value" errors.  Today, we are going to take a look at a different kind of errors that are often just as mysterious and frustrating: the dreaded "Error 500" when accessing any of Movable Type's .cgi scripts.  The error logs of the webserver only tell you about "Premature end of script headers" in some script.  Real informative...
A great way to bring in new visitors to your Movable Type blog is to automatically post the titles and links of your entries to Twitter.  Not only will you stimulate your followers to click through to your latest and greatest entry, but also people happening to see your tweet via Twitter Search might come by.  So what is the easiest way to do this?
For some things you want to display a count of, Movable Type provides handy template tags like <mt:entrycommentcount>, <mt:blogentrycount>, <mt:blogcategorycount> or even <mt:blogpagecount>.  But what if you wanted to count something else?  The number of authors whose name starts with a 'B'?  The number of comments containing a certain brand name?  The number of entry titles that have a word in them?
As you may have noticed, from time to time I illustrate an entry on this blog with a little snippet of template code.  For example, something like: <mt:Entries> or even <$mt:Link template="archive_index"$>.  As you can see, these snippets come with the same syntax highlighting used in Movable Type's template editing screens.  Here is a little tip to get the same effect on your blog. 
A number of plugins written for Movable Type 4 don't work under Movable Type 5 because the screens they add to the application have become unreachable.  Movable Type 4 used to have a 'Create' and a 'Manage' menu, and many plugins added links under these headings.  Movable Type 5 does not have these two headings anymore. Technically many of these plugins still work if you know the links to their screens, but there is a better way.
So you just set up a Movable Type blog, posted some entries and the first (real) comments start coming in.  And then, it happens: all sorts of shady people start spamming your comments section with offers for various pharmaceutical products, or with seemingly on-topic comments which actually mostly contain links to really spammy websites full of ads.  Now what?
As soon as a Movable Type powered site becomes somewhat popular, there is often a steep increase in server load. This despite Movable Type's static publishing model.  How can this be?  Serving static HTML pages isn't that much work, is it?  Some investigation often reveals that it is the search script (mt-search.cgi) which is causing all the load.  Now what?
Sometimes you don't want everybody to be able to read your blog, or at least certain parts of it.  Because of the standard way Movable Type uses to publish your blog (static HTML files) it is not always as easy to shield your blog from unwanted visitors.  But there is a relatively straightforward and simple way if you are on an apache webserver (like 99% of all MT installations I think).
Anybody who has used Movable Type for some time has seen it.  The dreaded error message: Can't call method "..." on an undefined value at (some file) line (some number).  So what does it mean when you get this error, and more importantly, how can you fix it?  First, let's have a look at the cause of the error.  In order to understand what is going on you first need to know a bit about how Movable Type works.
So you have your boring old monthly, category and individual entry archives, neatly published in the default locations with the default path names.  Nothing is easier than generating links to these archives, using the standard <mt:archivelink> tag.  But what if you are also publishing a version of your archives that is optimized for mobile browsing, published in the same location but with a slightly different filename?
Sometimes you may want to display a number along with your entry, to indicate how many entries have come before it for example.  There is no simple, built-in way to do this in Movable Type.  You could use the <mt:entryid> tag, but only if there is just a single blog in your system and you never delete an entry.  Because if you do there will be gaps in your order.  I recently had to display entry numbers on a multi-blog system where entries got deleted sometims.  Here is my solution.

Movable Type Help?

"Can my Movable Type issue or project be taken care of by a professional?" Yes It Can Be! Contact YesItCan.be
Powered by Movable Type 5.2.7