Recently in Tags Category

Recently when working on updating the Photo Gallery plugin to work with Movable Type 4.1 I found myself neck deep in some of the most complicated Movable Type templates I have ever seen. Of course, their complexity is exactly why the Photo Gallery plugin outputs such beautiful results.

Within these templates I have the need to take an arbitrary image asset of any size, and scale it proportionally to fit inside a well defined area. This could be a thumbnail, or a larger version of the photo at hand. What I found myself doing is replicating the same template code over and over again in order to produce the output I desired throughout the template set. Here is the template code I was using:

<MTSetVarBlock name="width" trim="1"><MTEntryAssets><MTAssetProperty 
    property="image_width"></MTEntryAssets></MTSetVarBlock>
<MTSetVarBlock name="height" trim="1"><MTEntryAssets><MTAssetProperty 
    property="image_height"></MTEntryAssets></MTSetVarBlock>
<mt:if name="width" gt="$height">
    <MTSetVarBlock name="img"><MTEntryAssets><mt:AssetThumbnailLink width="90" 
        regex_replace="/^<a[^>]*>(<img[^>]*>)<\/a>$/","$1" /></MTEntryAssets></MTSetVarBlock>
<mt:else>
    <MTSetVarBlock name="img"><MTEntryAssets><mt:AssetThumbnailLink height="90" 
        regex_replace="/^<a[^>]*>(<img[^>]*>)<\/a>$/","$1" /></MTEntryAssets></MTSetVarBlock>
</mt:if>

Yikes.

To complicate things further, each time I cut and pasted this code around I had to modify it slightly depending upon the size of the photo I wanted to output. This presented the following problems:

  • my template code was getting very messy.
  • my template code was getting harder and harder to update because I had the same code in multiple places

What I found myself in need of is something a developer might call a "function" or "macro." In layman's terms, I needed a way to write this template code once, and then to invoke along with a few parameters in order to change its behavior and output as needed.

Luckily, Movable Type has exactly what I needed: a little template tag called MTSetVarTemplate. This template tag allowed me to define just such a macro so that I could reduce all of the complicated template code above into something far simpler:

<MTVar name="photo" max_size="90">

Wow, what an improvement!

Jaclyn asked why she wasn't able to get tags imported to a new MT4 installation. While Movable Type 4 includes an entry's tags in the import specifications, and also exports those tags when saving the data, no prior versions have exported the tags, even though tags have been natively supported since MT 3.3x. Luckily, it's easy to get them.

First, make a backup of ImportExport.pm from your original Movable Type installation, which is the Perl module that handles the export. Do this because you want to make sure that you have a good copy, just in case something goes awry. Put this backup in a safe place, and work with the copy of the file, just in case. Ready? Good.

Tag Cloud on PHP in Movable Type 4

| 6 Comments

Movable Type has become one of the first platforms in which tags have appeared . It happened in the third version. And in the fourth version it is possible to add tags not only to post, but also to uploaded files or created pages. But functionality of the tag MTTags is not thought over up to the end in the current version as well as in the previous version MT. It is necessary to make some efforts to have a normal Tag Cloud.

Putting MT:MultiBlog to Work

| 5 Comments

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.

How to Make a Subject Index Using Tags

| 7 Comments

index-example.jpg

Updated August 23, 2006. Fixed a few things.

Most non-fiction books have a Subject Index in the back, making it easy for the reader to look up topics of interest, based on a word or term. With MT3.3's new tagging feature, you can create an alphabetical index of your entries tags. You can see this in action with LMT's Tag Index.

Related Tags

| No Comments

Movable Type 3.3 Comes with a powerful new tagging feature, the details of which Jay Allen outlines in Everyone Loves Tags.

If you have implemented MT's tagging system on your blog, and you click on a tag on an entry, it takes you to a tag search result page with a list of the entries tagged with that tag (and their excerpts), which is what you would expect. In the sidebar of the tag search result page is also listed the entire list of tags in the blog. If you have a lot of tags, say in the hundreds, you might not want them all listed out. You might just want the tags listed that are in some way related to the tag that was just clicked.

Fortunately, the TagSupplementals Plugin from developer Hirotaka Ogawa provides the ability to display related tags. (If you use this plugin, be sure to make a donation to Hirotaka's efforts using the PayPal button on his site.) Here are the steps you need to take to swap out the list of all tags for a list of only related tags:

Converting Keywords into Tags

| 1 Comment

MT3.3 has a new field for tags, and a lot of new tagging functionality. If you have been using the keywords field for pseudo tagging purposes, you can easily populate your new tag field with your keywords, without having to go back and re-enter every one.

Plugin developer Hirotaka Ogawa has written a simple script - mt-keywords2tags that will populate the tag field of your entries with any keywords that are already in the keyword field for those entries.

Just upload the script to your MT directory, the same place you have the rest of your mt cgi scripts (mt.cgi, mt-search.cgi, etc.). Set the permissions of the script to 755. Then point your browser to the cgi file. After the script runs, delete it from your server. Many thanks to Hirotaka for making this so easy for us.

Technorati Tags and Movable Type

| 9 Comments

technorati-tags-banner.gif

Technorati, a leading blog search engine and index, has made it very easy for blog authors to get their "tagged" blog entries into Technorati's tag index. What is a tag? A tag is a type of category, and the process of tagging a simplified categorization method for your entries. The concept of tags has become popular with services such as del.icio.us and Flickr. By creating tag classifications for your weblog entries, you make it easy for Technorati to index your blog entries by tags that you specify. With Technorati tagging, you get to choose how you want your weblog entries to be classified, in contrast to algorithm-driven search engines like Google that make their own classifications based on what can be derived from the keywords in your text. Thus, people searching Technorati for weblogs having to do with will find blog entries in which the weblog author has categorized her entry as having to do with book reviews.

About this Archive

This page is an archive of recent entries in the Tags category.

Style is the previous category.

Templates is the next category.

Find recent content on the main index or look in the archives to find all content.