March 2010 Archives

Movable Type has a nice collection of tools you can use to filter the content of comments or trackbacks with.  Want to ban a specific word or phrase?  No problem!  Even patterns are possible.  The only tricky thing is knowing where you can reach these settings and what they mean.  Let's have a look!
I noticed this forum question today: "Split Modifier for Template Tags?". A 'Sunset Bill' wanted to know if there was an easy or built-in way in Movable Type's templating language to split the comma-separated contents of a custom field into multiple parts that could be easily looped over.  He was wondering if a 'split' modifier might exist or if someone had already created one using a plugin.
During normal use of Movable Type you probably never have to worry about character sets or encoding.  But when you migrate your installation to a new server or you add a Japanese, French, German... guestblogger, that is when things can get tricky and it might be worth knowing a thing or two about what is the deal with strange characters, accents, ümlauts and all the interesting ways in which they can fail to display.
Movable Type's "Create Entry" screen has a lot of stuff on it.  A lot of it you might not even be using all that often, or even not at all (hi "Excerpt" and "Keywords", I'm looking at you...).  And all those custom fields you added to your entries, wouldn't it be nice if you could just reorder them a bit to make things more logical?  Well, actually you can...
Here is a short tip for people writing their own plugins for Movable Type.  There is excellent documentation guiding you through the initial steps of setting up your first plugin in the Developer Guide, which is linked to prominently from the main documentation screen.  Unfortunately the guide does not explain how to add a configuration or settings screen to your plugin.  For some reason, this bit of information can only be found here, in the guide for creating Movable Type applications.
Movable Type has a pretty neat set of features called 'MultiBlog' which allow you to display content on your blog that is coming from other blogs on your installation (aggregation...).  That is all very nice if all you want to do is show a combined list of the most recent entries of (for example) blog 1, 2 and 5 (just do <mt:entries blog_ids="1,2,5">...</mt:entries> and you are done).  But what if you want more control over the entries that are being displayed?
Normally to set the publishing options of a Movable Type template, you would need to click the 'Template Options' link at the bottom of the Edit Template screen, then pick the desired publication method (static, background, dynamic...) and finally save.  If you need to set the options for several templates, this involves lots of tedious clicking as you need to open every template individually.
Nothing is more tedious in Movable Type than to have to manually rebuild all the blogs in your installation one by one after you have modified some crucial system-level template module that is used everywhere.  It is not fun if you have a few dozen blogs, and it gets positively annoying if you have more than a hundred, something that is not uncommon on an intranet or with an MT-powered blogging service.
In the previous article in this series I talked about how you can set publication of certain templates to 'Manually' to speed up publishing of your blog.  Today will discuss setting up caching and server side includes, and the reasons for using them.  The first reason is pretty important: if you don't use them the sidebar(s) on most of your Movable Type blog will constantly be out of date if you are using the default templates.
Suppose you stored some information in a series of custom fields (attached to an entry) that all have the same name, except for an incrementing number.  Something like my_field_1, my_field_2, my_field_3, all the way up to my_field_20.  And that you had to display all this information, sequentially.  This is what I had to do earlier today, and here is how I did it.
Did you know that 'search_by_meta' is a little known method of the MT::Object class?  Until today, I didn't, but I came accros this  hidden gem today while writing a custom Perl script for one of my Movable Type installations.  Basically I needed to pull one specific page from the database based on a value that was stored in a custom field.  It seemed easy enough, and at first I tried the standard 'load' method...